Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #111147
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Appending an asterisk to the end of each line |
| Date | 2016-07-05 18:40 -0400 |
| 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> |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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