[Tutor] read() question

Kent Johnson kent37 at tds.net
Wed May 11 19:18:06 CEST 2005


John Carmona wrote:
> MyText = open('The_text.txt','r').read()
> 
> In the above line could someone tell me what the 'r' stand for. Many thanks

'read', i.e open the file for reading, as opposed to 'w' for writing. For more options see the docs 
for file() (a synonym for open) here:
http://docs.python.org/lib/built-in-funcs.html

Kent



More information about the Tutor mailing list