![](https://img-blog.csdnimg.cn/2021031109381611.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
python
平常练手的python整理
打野的典韦
这个作者很懒,什么都没留下…
展开
-
Python字符串转字典值报错ValueError: dictionary update sequence element #0 has length 1; 2 is required
刚开始学习Python,认为字符串和字典之间转换直接用dict()就能搞定,结果程序运行起来之后报错:ValueError: dictionary update sequence element #0 has length 1; 2 is required 后来查找资料,这个数据之间不能直接转换。需要用到函数eval()转换。 转换之后代码运行 ...原创 2021-03-24 09:54:30 · 3324 阅读 · 0 评论 -
Python的文件读写
文件读写属性表格: 贴一段代码,随便写的,没有用异常捕获,有空改进 import os def writelog(*key): path = "../log" if os.chdir(path) == '': print("chdir error") else: f = open("logger.txt", 'a+') if f == '': return -1 else:原创 2021-03-11 09:48:17 · 62 阅读 · 0 评论