python随手记

1、

data=123
isinstance(data,dict)#类型对比,相同返回true,不相同返回false

2、

globals()#globals 全局名字空间
locals()#locals 局部名字空间

3、

#str.replace(old, new[, max])把old字符串替换为new字符串,不超过max个
str = "Make a class named %%% that is-a %%%."
new_str = str.replace("%%%", "hahaha", 1)

 

posted @ 2019-06-05 17:19  尐少  阅读(108)  评论(0)    收藏  举报