vze4rx4y at verizon.net
Thu Jan 2 08:42:42 CET 2003
"Jc" <jciber16 at hotpop.com> wrote in message
news:3e13e820_4 at corp.newsgroups.com...
> I'm writing a program and when it can't open a txt file it crashes. How
> I get it to report the file not being there? I set it up using the basic
> in_file = open(filename+".txt","r")
> text = in_file.read()
Wrap the call in a try/except block:
print 'Cannon open file'
More information about the Python-list