list to string

Skip Montanaro skip at pobox.com
Tue Jul 23 17:59:34 EDT 2002


    David> fn = file('foo.txt')
    David> txt = fn.readlines()
    David> str = ?something?(txt) # or txt.?something?()...

Assuming what you really want is to get the contents of the file in one
gulp, this should work:

    fn = file('foo.txt')
    str = fn.read()

-- 
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html




More information about the Python-list mailing list