使用 import types
直接和某個你想判斷的數據類型比較
e.g.
import types
type(x)==type(1) # 判斷是否是int 類型
type(x)==type('a') # 是否是string 類型
比較麻煩的形式, 需要記憶
e.g.
import types
type(x) is types.IntType # 判斷是否int 類型
type(x) is types.StringType #是否string類型
…
使用 import types
直接和某個你想判斷的數據類型比較
e.g.
import types
type(x)==type(1) # 判斷是否是int 類型
type(x)==type('a') # 是否是string 類型
比較麻煩的形式, 需要記憶
e.g.
import types
type(x) is types.IntType # 判斷是否int 類型
type(x) is types.StringType #是否string類型
…
import requests data = { 'channel': '99x', 'called_number': '135xxx', 'tts_code': 'TTS_xx', 'tts_p