Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111147

Re: Appending an asterisk to the end of each line

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Joel Goldstick <joel.goldstick@gmail.com>
Newsgroups comp.lang.python
Subject Re: Appending an asterisk to the end of each line
Date Tue, 5 Jul 2016 18:40:51 -0400
Lines 46
Message-ID <mailman.111.1467758454.2295.python-list@python.org> (permalink)
References <acbonb5kk4g5vr68rlpipmrehekitpfb4b@4ax.com> <CAPM-O+wOsNfRHmvxbftukD6PV3=mAjq+epa4s1MS7Rm8mVk+pA@mail.gmail.com> <mailman.110.1467757653.2295.python-list@python.org> <s3donb9552u0v4rv63gdqvisq44otam9l9@4ax.com> <CAPM-O+wHuiX5YZ_syXah2zEZLyc5wbKTVxzWCAn4KyEfjiSp=A@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de KSJcyLHvdURoDuZ1iXDfpQueG5t2+o2qob2eRsdd3zqQ==
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'cc:addr :python-list': 0.09; "'w')": 0.09; 'url:blog': 0.10; 'python': 0.10; 'python.': 0.11; "'r')": 0.16; '2016': 0.16; '>>on': 0.16; 'empty.': 0.16; 'file?': 0.16; 'received:io': 0.16; 'received :mail-oi0-x22a.google.com': 0.16; 'received:psf.io': 0.16; 'reinstalled': 0.16; 'wrote:': 0.16; 'creates': 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'posted': 0.21; 'tried': 0.24; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'installed': 0.26; 'message-id:@mail.gmail.com': 0.27; "skip:' 10": 0.28; 'subject:end': 0.29; 'url:mailman': 0.30; 'folder': 0.30; 'run': 0.33; 'url:python': 0.33; 'url:listinfo': 0.34; 'tue,': 0.34; 'file': 0.34; 'running': 0.34; 'received:google.com': 0.35; 'so,': 0.35; 'text': 0.35; 'path': 0.35; 'but': 0.36; 'url:org': 0.36; 'lines': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'several': 0.38; 'skip:o 20': 0.38; 'subject:the': 0.39; 'url:mail': 0.40; 'ago.': 0.61; 'reuse': 0.66; 'url:info': 0.71; 'jul': 0.72; 'seymore4head': 0.84; 'subject:Appending': 0.84; 'to:none': 0.91; 'joel': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=3SojnexhmP88Z23v+9DEKxrOUdTmFMNOMqRNh+Ke9hw=; b=iSs8DsIHJvUfba8alp78SVD8Bp7oZS2uw7DVBm7BlFgs4+cH7VJ5btnvj437Q+fga+ inVnBKLH1YF/+bRq43xldtEfNoX8iExtscewyOHuIqUDseAN7Zy+byA3EvnFzXlvfxlK rUFpXKBWqckT/N06CKKx3NyY2zadAc2gyIUzUCfAbrjICEuw8uH9fNhYk8rayI4tXAh9 4n5tdIkoX3+QX+xNJZWESbPQu7URYWbpVEnGjqW0b7sETBe+vaxOsPAAgjc4G1rRiG1h GocaFiJiDG85gnRPSNgX9H9vwMocGL5pK2MElRQlYsX1QGJO0EPDc4WU4KzEXdOLpKlK Z9Lg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=3SojnexhmP88Z23v+9DEKxrOUdTmFMNOMqRNh+Ke9hw=; b=iZCx0gjavOmB/Hk88M08HKG6nJGOIuAkf3klKZNp+gYdqIZhOycilcZKspnzZjyOOg afjVjx0/sZEGJgdoyU0hu36xXRkJJh/uVkT99Td3cqTvhdw/BMv2/PflgyPLuZYs+L/k 81phWFSJ7vJ/ufY3lTDVklZ+Pk/leHBasM3kd63zR4kgKNfWmhCoyywElqPMKPI7igHU 8B4QyJyL8rGt7JYmL5GL6FjbUeaJoIJChnuoK5vE9gQccYhyyQZUuzGKisOuMlqFnAD7 +yfXdkjdAJ7WdnmINdF7LlxwaeIeFJmDrUGGOnTWZ/sshC+CU3yeCnxToBYpwCFksE62 Q0VA==
X-Gm-Message-State ALyK8tJyQH6/wFSsExBuA+I3qFRSHi5XAyUYpyyGpqQpPimK3/6cmWm+Z9nTO9wbl0JTaKGgSXH2lqk80pIzFQ==
X-Received by 10.157.1.199 with SMTP id e65mr11822906ote.141.1467758452326; Tue, 05 Jul 2016 15:40:52 -0700 (PDT)
In-Reply-To <s3donb9552u0v4rv63gdqvisq44otam9l9@4ax.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAPM-O+wHuiX5YZ_syXah2zEZLyc5wbKTVxzWCAn4KyEfjiSp=A@mail.gmail.com>
X-Mailman-Original-References <acbonb5kk4g5vr68rlpipmrehekitpfb4b@4ax.com> <CAPM-O+wOsNfRHmvxbftukD6PV3=mAjq+epa4s1MS7Rm8mVk+pA@mail.gmail.com> <mailman.110.1467757653.2295.python-list@python.org> <s3donb9552u0v4rv63gdqvisq44otam9l9@4ax.com>
Xref csiph.com comp.lang.python:111147

Show key headers only | View raw


On Tue, Jul 5, 2016 at 6:29 PM, Seymore4Head
<Seymore4Head@hotmail.invalid> wrote:
> On Tue, 5 Jul 2016 18:27:25 -0400, Joel Goldstick
> <joel.goldstick@gmail.com> wrote:
>
>>On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head
>><Seymore4Head@hotmail.invalid> wrote:
>>> import os
>>>
>>> f_in = open('win.txt', 'r')
>>> f_out = open('win_new.txt', 'w')
>>>
>>> for line in f_in.read().splitlines():
>>>     f_out.write(line + " *\n")
>>>
>>> f_in.close()
>>> f_out.close()
>>>
>>> os.rename('win.txt', 'win_old.txt')
>>> os.rename('win_new.txt', 'win.txt')
>>>
>>>
>>> I just tried to reuse this program that was posted several months ago.
>>> I am using a text flie that is about 200 lines long and have named it
>>> win.txt.  The file it creates when I run the program is win_new.txt
>>> but it's empty.
>>>
>>>
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>
>>Are you running program in same folder as text file?
>
> Yes.  I just reinstalled Python.  Python is not installed in the same
> folder and I don't remember if it needs to have path entered.
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list

So, if you type python, do you enter the python shell?

-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Appending an asterisk to the end of each line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2016-07-05 18:05 -0400
  Re: Appending an asterisk to the end of each line Joel Goldstick <joel.goldstick@gmail.com> - 2016-07-05 18:27 -0400
    Re: Appending an asterisk to the end of each line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2016-07-05 18:29 -0400
      Re: Appending an asterisk to the end of each line Joel Goldstick <joel.goldstick@gmail.com> - 2016-07-05 18:40 -0400
        Re: Appending an asterisk to the end of each line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2016-07-05 19:04 -0400
          Re: Appending an asterisk to the end of each line Chris Angelico <rosuav@gmail.com> - 2016-07-06 09:38 +1000
            Re: Appending an asterisk to the end of each line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2016-07-05 19:49 -0400
  Re: Appending an asterisk to the end of each line MRAB <python@mrabarnett.plus.com> - 2016-07-06 00:03 +0100
    Re: Appending an asterisk to the end of each line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2016-07-05 19:15 -0400
  Re: Appending an asterisk to the end of each line Joel Goldstick <joel.goldstick@gmail.com> - 2016-07-05 19:15 -0400
    Re: Appending an asterisk to the end of each line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2016-07-05 19:29 -0400
      Re: Appending an asterisk to the end of each line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2016-07-05 19:45 -0400
        Re: Appending an asterisk to the end of each line MRAB <python@mrabarnett.plus.com> - 2016-07-06 01:05 +0100
          Re: Appending an asterisk to the end of each line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2016-07-05 20:05 -0400
            Re: Appending an asterisk to the end of each line MRAB <python@mrabarnett.plus.com> - 2016-07-06 03:15 +0100
            Re: Appending an asterisk to the end of each line Steven D'Aprano <steve@pearwood.info> - 2016-07-06 12:35 +1000
  Re: Appending an asterisk to the end of each line Larry Hudson <orgnut@yahoo.com> - 2016-07-05 21:37 -0700
    Re: Appending an asterisk to the end of each line cs@zip.com.au - 2016-07-06 15:35 +1000

csiph-web