Re: Appending an asterisk to the end of each line

2016-07-05 Thread cs
On 05Jul2016 21:37, Python List wrote: On 07/05/2016 03:05 PM, Seymore4Head 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.re

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Larry Hudson via Python-list
On 07/05/2016 03:05 PM, Seymore4Head 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

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Steven D'Aprano
On Wed, 6 Jul 2016 10:05 am, Seymore4Head wrote: > On Wed, 6 Jul 2016 01:05:12 +0100, MRAB > wrote: >>That suggests to me that it's an encoding problem (the traceback >>would've indicated that). >> >>Specify an encoding when you open the files: >> >>f_in = open('win.txt', 'r', encoding='utf-8')

Re: Appending an asterisk to the end of each line

2016-07-05 Thread MRAB
On 2016-07-06 01:05, Seymore4Head wrote: On Wed, 6 Jul 2016 01:05:12 +0100, MRAB wrote: On 2016-07-06 00:45, Seymore4Head wrote: On Tue, 05 Jul 2016 19:29:21 -0400, Seymore4Head wrote: On Tue, 5 Jul 2016 19:15:23 -0400, Joel Goldstick wrote: On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote:

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Wed, 6 Jul 2016 01:05:12 +0100, MRAB wrote: >On 2016-07-06 00:45, Seymore4Head wrote: >> On Tue, 05 Jul 2016 19:29:21 -0400, Seymore4Head >> wrote: >> >>>On Tue, 5 Jul 2016 19:15:23 -0400, Joel Goldstick >>> wrote: >>> On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote: > On 2016-07-05 23:05

Re: Appending an asterisk to the end of each line

2016-07-05 Thread MRAB
On 2016-07-06 00:45, Seymore4Head wrote: On Tue, 05 Jul 2016 19:29:21 -0400, Seymore4Head wrote: On Tue, 5 Jul 2016 19:15:23 -0400, Joel Goldstick wrote: On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote: On 2016-07-05 23:05, Seymore4Head wrote: import os f_in = open('win.txt', 'r') f_out = o

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Wed, 6 Jul 2016 09:38:47 +1000, Chris Angelico wrote: >On Wed, Jul 6, 2016 at 9:04 AM, Seymore4Head > wrote: >> 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. >> >

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Tue, 05 Jul 2016 19:29:21 -0400, Seymore4Head wrote: >On Tue, 5 Jul 2016 19:15:23 -0400, Joel Goldstick > wrote: > >>On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote: >>> On 2016-07-05 23:05, Seymore4Head wrote: import os f_in = open('win.txt', 'r') f_out = open('win_new.tx

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Tue, 5 Jul 2016 19:15:23 -0400, Joel Goldstick wrote: >On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote: >> On 2016-07-05 23:05, Seymore4Head 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

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Chris Angelico
On Wed, Jul 6, 2016 at 9:04 AM, Seymore4Head wrote: > 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

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Wed, 6 Jul 2016 00:03:29 +0100, MRAB wrote: >On 2016-07-05 23:05, Seymore4Head 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.re

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Joel Goldstick
On Tue, Jul 5, 2016 at 7:03 PM, MRAB wrote: > On 2016-07-05 23:05, Seymore4Head 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.re

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Tue, 5 Jul 2016 18:40:51 -0400, Joel Goldstick wrote: >On Tue, Jul 5, 2016 at 6:29 PM, Seymore4Head > wrote: >> On Tue, 5 Jul 2016 18:27:25 -0400, Joel Goldstick >> wrote: >> >>>On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head >>> wrote: import os f_in = open('win.txt', 'r') f

Re: Appending an asterisk to the end of each line

2016-07-05 Thread MRAB
On 2016-07-05 23:05, Seymore4Head 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 trie

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Joel Goldstick
On Tue, Jul 5, 2016 at 6:29 PM, Seymore4Head wrote: > On Tue, 5 Jul 2016 18:27:25 -0400, Joel Goldstick > wrote: > >>On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head >> wrote: >>> import os >>> >>> f_in = open('win.txt', 'r') >>> f_out = open('win_new.txt', 'w') >>> >>> for line in f_in.read().splitl

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Seymore4Head
On Tue, 5 Jul 2016 18:27:25 -0400, Joel Goldstick wrote: >On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head > 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_

Re: Appending an asterisk to the end of each line

2016-07-05 Thread Joel Goldstick
On Tue, Jul 5, 2016 at 6:05 PM, Seymore4Head 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_ne