データ型の判定
取得と判定
>>> >>> a = "EEECCCAAABBBDDD" >>> >>> tp = type(a) >>> print tp <type 'str'> >>> >>> if isinstance(a, str): print "文字列" ... 文字列 >>>
isinstanceの二つめの引数は文字列じゃないので注意
2009年04月03日(金) 13:18:38 Modified by hebi_
[ パソコン ] |
>>> >>> a = "EEECCCAAABBBDDD" >>> >>> tp = type(a) >>> print tp <type 'str'> >>> >>> if isinstance(a, str): print "文字列" ... 文字列 >>>