Catch data type miss match,catchmatch,value = '2'p
Catch data type miss match,catchmatch,value = '2'p
value = '2'print repr(value), 'is ',try: value + 0except TypeError: # not a number, maybe a string, Unicode, UserString...? try: value + '' except TypeError: print 'neither a number nor a string' else: print 'a string or string-like value'else: print 'a number of some kind'
相关内容
- For loop demo,forloopdemo,words = ['A'
- for with else,withelse,from math im
- Read a number and time int value,numbervalue,num = raw_in
- Operator Precedence,operatorprecedence,#--+--------
- Raise exception and catch it,raiseexception,def err():
- Effects of Setting the Default Encoding,effectsencoding,import sys
- Use the unicode() function produce a corresponding Unicode string fro
- Key action: keypressed,actionkeypressed,from Tkinter
- Image button mouse action: mouse in, out and rollover,mouserollover
- Mouse events on a frame: Mouse entered,eventsentered,from Tkinter
评论关闭