Seymore4Head wrote: > On Tue, 19 Apr 2016 18:29:38 -0400, Seymore4Head > <Seymore4Head@Hotmail.invalid> wrote: > > I am going to forget using a directory path. > I would like to take the file win.txt and append a space and the * > symbol. > > f = open('win.txt', 'r+') > for line in f: > f.read(line) > f.write(line+" *") > > This doesn't work. Would someone fix it please? It is for a task I > am trying to accomplish just for a home task.
"for line in f:" already means "make the variable line equal to each line in f sequentially". f.read is both superfluous and also doesn't do that. Leave it out entirely. The next problem you'll have is that iterating over the lines of the file leaves the newline at the end of line, so your * will end up on the wrong line. Do yourself a favor: https://docs.python.org/3/tutorial/inputoutput.html isn't very long. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list