> i am new to programming language and python. I wonder how to get a line
> text
> from input file.
f = open('somefile.txt')
line = f.readline()
For more details on using files see the Handling Files topic in my web
tutor.
Alan G
Author of the learn to program web tutor
http://www.freenetpages
On Wed, 22 Mar 2006, Keo Sophon wrote:
> i am new to programming language and python. I wonder how to get a line
> text from input file.
Hi Sophon,
You may want to look at:
http://wiki.python.org/moin/BeginnersGuide/NonProgrammers
Many of the tutorials there talk about reading from files
Keo Sophon wrote:
> Hi all,
>
> i am new to programming language and python. I wonder how to get a line text
> from input file.
The simplest Python idiom to do something with each line of a file is this:
for line in open('somefile.txt'):
# do something with line
You can find out more he
Hi all,
i am new to programming language and python. I wonder how to get a line text
from input file.
Thanks,
sophon
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor