[Tutor] return first line

Rafik Ouerchefani rafik at ubuntu.com
Mon Mar 15 17:23:34 CET 2010


Hi,

assuming that your content is in input.txt, you can do :

>>> f = open("/path/to/content.txt")
>>> f.readline()

it will return the first line only

cheers,

- Rafik


More information about the Tutor mailing list