[Tutor] return first line

Norman Khine norman at khine.net
Mon Mar 15 18:19:27 CET 2010


hi, i tried this, my problem is that the file isfrom a python list -
here is the code i have so far:

http://paste.lisp.org/+22E5/1

as the first line for each item contains the 'title' which has
different tags, i want to find a way to strip this out.

any advise much appreciated
	




On Mon, Mar 15, 2010 at 5:23 PM, Rafik Ouerchefani <rafik at ubuntu.com> wrote:
> 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