国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Python 判斷變量的數據類型

2019-11-08 02:54:31
字體:
來源:轉載
供稿:網友
import types aaa = 0 PRint type(aaa) if type(aaa) is types.IntType: print "the type of aaa is int" if isinstance(aaa,int): print "the type of aaa is int" bbb = 'hello' print type(bbb) if type(bbb) is types.StringType: print "the type of bbb is string" if isinstance(bbb,str): print "the type of bbb is string" #if the type is NoneType,the isinstance does not work #we should judge the NoneType like below #if row is None #if type(row) is types.NoneType #In my opinion,use the types to judge the type of a param is convinient, use the isinstance to judge whether a instance is a type of a class or not
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 马尔康县| 军事| 定西市| 铜陵市| 富民县| 龙南县| 安福县| 河间市| 久治县| 潮安县| 法库县| 化州市| 定西市| 九龙城区| 濮阳县| 桃源县| 如东县| 平邑县| 南宫市| 北京市| 法库县| 天峨县| 朝阳市| 甘洛县| 泽州县| 忻城县| 陇南市| 安国市| 勃利县| 百色市| 集贤县| 普宁市| 汝南县| 宁强县| 三都| 西充县| 黑河市| 余干县| 锦屏县| 阜平县| 忻州市|