Handle File reading Exception,handlereading,import systr
Handle File reading Exception,handlereading,import systr
import systry: f = open('myfile.txt') s = f.readline() i = int(s.strip())except IOError, (errno, strerror): print 'I/O error(%s): %s' % (errno, strerror)except ValueError: print 'Could not convert data to an integer.'except: print 'Unexpected error:', sys.exc_info()[0] raise
- Create a base class for exceptions defined by a module,
- Assign list to a list item,assignitem,L = ['Alread
- String literals span multiple lines in several ways.,l
- A Simple function definition: return a tuple.,definiti
- Generic access to DBM-style databases,dbm-styledatabas
- String formatting: Integer, Decimal and Hexadeciaml,,i
热门文章:
相关内容
- Create a base class for exceptions defined by a module,exceptionsde
- Assign list to a list item,assignitem,L = ['Alread
- String literals span multiple lines in several ways.,literalsmultip
- A Simple function definition: return a tuple.,definitiontuple,def q
- Generic access to DBM-style databases,dbm-styledatabases,import fil
- String formatting: Integer, Decimal and Hexadeciaml,,integerValue
- range with step,rangestep,from math im
- Zip function demo: returns a list of tuples,returnstuples,D1 = {}D
- Print lines/words/chars stats of files by extension,charsstats,'''P
- ord function demo,ordfunction,print ord('s
评论关闭