Print out exception info,printexception,#the excepti
Print out exception info,printexception,#the excepti
#the exception instance defines __getitem__ and __str__ so the arguments can be #accessed or printed directly without having to reference .args.try: raise Exception('spam', 'eggs')except Exception, inst: print type(inst) # the exception instance print inst.args # arguments stored in .args print inst # __str__ allows args to printed directly x, y = inst # __getitem__ allows args to be unpacked directly print 'x =', x print 'y =', y
- Concatinate two lists,concatinatelists,inventory =
- While with break,whilewithbreak,while 1:
- How to Update Lists,howtoupdatelists,aList = [123
- Convert string:normal to unicode,normalunicode,print u
- Open a webbrowser with Google.,openwebbrowser,'''PYTHO
- Splitting Pathnames,splittingpathnames,import os os
热门文章:
相关内容
- Concatinate two lists,concatinatelists,inventory =
- While with break,whilewithbreak,while 1:
- How to Update Lists,howtoupdatelists,aList = [123
- Convert string:normal to unicode,normalunicode,print unicod
- Open a webbrowser with Google.,openwebbrowser,'''PYTHON SO
- Splitting Pathnames,splittingpathnames,import os os
- Define and use Modules,definemodules,# Fibonacci
- Get the length: number of items inside a string,lengthitems,print l
- Formatted print: float,formattedfloat,print '%.2f'
- String indexing: Random Access,indexingrandom,import rando
评论关闭