[Tutor] Help with re in Python 3

Andreas Perstinger andreas.perstinger at gmx.net
Sat Nov 5 08:24:51 CET 2011


On 2011-11-04 20:59, Albert-Jan Roskam wrote:
> It seems that you are not opening the file properly. You could do
> f = file('///Users/joebatt/Desktop/python3.txt','r')
> or:
> withfile('///Users/joebatt/Desktop/python3.txt','r') as f:

OP is using Python 3, where "file" is removed. Thus, you have to use "open":

f = open('...')

with open('...') as f:

Bye, Andreas


More information about the Tutor mailing list