[Tutor] read line x from a file

J. M. Strother jstro at swbell.net
Sat Jan 22 05:22:55 CET 2005


I have  a text file containing 336 records.
I can read and print out the whole file without any problem.
What I want to do is read and print out one record only (chosen at 
random). So I need to get to record x, select it, and then print it (or 
store it in a variable).
Can anyone tell me now to do this?

I'm new to Python and programming, so sorry if this is very basic. Thanks.

jon


More information about the Tutor mailing list