PYTHON 变量类型检测
作者:互联网
def typeof(variate): type=None if isinstance(variate,int): type = "int" elif isinstance(variate,str): type = "str" elif isinstance(variate,float): type = "float" elif isinstance(variate,list): type = "list" elif isinstance(variate,tuple): type = "tuple" elif isinstance(variate,dict): type = "dict" elif isinstance(variate,set): type = "set" return type
标签:elif,set,变量,tuple,PYTHON,检测,variate,isinstance,type 来源: https://www.cnblogs.com/xkdn/p/16088612.html