
python
遇见更好的自己~
这个作者很懒,什么都没留下…
展开
-
staticmethod 和 classmethod 的适用场景
参考链接:https://www.cnblogs.com/hello-/articles/8177836.html转载 2020-11-20 18:12:08 · 174 阅读 · 0 评论 -
python中的驻留机制
a = 1b = 1print(a is b)c = 1000d = 1000print(c is d)print(id([1])==id([1]))print(id([1])==id([2,3]))x = 'hello'y = 'hello'print(x is y)x1 = 'hello world'y1 = 'hello world'print(x1 is y1)在py文件运行上面代码都是True,在交互式输入执行:>>> c = 1000&原创 2020-11-20 16:24:18 · 238 阅读 · 0 评论 -
python的with用法
原文链接:http://blog.kissdata.com/2014/05/23/python-with.html转载 2020-11-19 22:30:57 · 83 阅读 · 0 评论 -
python之json和dict转换
import jsondict = {'id':1, 'name':'alan', 'sex':'man'}# dict_to_jsonjson_data = json.dumps(dict)# json_to_dictdict_data = json.loads(json_data)# 字典转json然后写入到文件,文件不存在自动创建with open('a.json', 'w') as f: json.dump(dict, f)# 读取json文件转换为dictwit原创 2020-11-18 17:04:07 · 340 阅读 · 0 评论 -
python单链表的一些操作
```pythonclass Node(object): def __init__(self, data): ''' data:数据 next:指向下一个节点 ''' self.data = data self.next = Noneclass Single_LinkList(obje...原创 2019-11-21 23:24:28 · 137 阅读 · 0 评论