beginner's questions - manipulating text files

Ben Keshet keshet1 at
Wed Jul 2 01:16:30 CEST 2008


I am a very beginner Python programmer with limited programming 
experience overall.

I am trying to write a script that will search for the second and third 
appearance of the symbol '@' in a file, will read a random line between 
them, and write the line into a new file. So far I was only able to open 
the file using 'open', but I am not sure how to proceed. I tried to read 
it line by line using 'readline' but was not sure how to manipulate the 
text the way I need to.

Could anyone please give me |a basic guidance as for what functions may 
be useful for my purpose? (e.g how to search for a string '@' in a text? 
how to identify its location? how to choose a random number in a defined 
range? how to read that line number from a text file? etc.)|
|Any help will be much appreciated (please remember that I am a super 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list