[Tutor] subprocess adds %0A to end of string

Alan Gauld alan.gauld at btinternet.com
Mon Dec 22 03:38:42 CET 2008


"David" <david at abbottdavid.com> wrote

>>>         sys.stdout = open("podcast_links.txt", "a")
>>>         print '%s' % (entry.link)
>>>         sys.stdout.close()
>>> getFeed()

> This "podcast_file.write('%s: %s' % (entry.updated, entry.link))"
> writes it in one very long string

Use podcastfile.writeline() to write it line by line.

Read any tutorial on file handling to understand how/why these 
various methods work. Get to know files, you'll use them a lot!


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list