Appending an asterisk to the end of each line

Seymore4Head Seymore4Head at Hotmail.invalid
Tue Jul 5 19:04:33 EDT 2016


On Tue, 5 Jul 2016 18:40:51 -0400, Joel Goldstick
<joel.goldstick at gmail.com> wrote:

>On Tue, Jul 5, 2016 at 6:29 PM, Seymore4Head
><Seymore4Head at hotmail.invalid> wrote:
>> On Tue, 5 Jul 2016 18:27:25 -0400, Joel Goldstick
>> <joel.goldstick at gmail.com> wrote:
>>
>>>On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head
>>><Seymore4Head at 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?

I am using XP and launching the program from another drive/folder than
the boot drive.

The program has .py extension and the icon shows it is associated with
Python.

I tried "start run" and then typed python and it did show the dos box
with c:\python34/python.exe and the python shell.




More information about the Python-list mailing list