摘要: 切割字符串 split('x') >>> str = "http://baidu.com/test123?a=ddd&b=hhh">>> s1 = str.split('?') #切割字符串后返回,切分为2部分的字符串列表>>> print(s1)['http://baidu.com/test123 阅读全文
posted @ 2018-02-12 16:46 一语中的 阅读(255) 评论(0) 推荐(0) 编辑
摘要: dumps是将dict转化成str格式,loads是将str转化成dict格式。 dump和load也是类似的功能,只是与文件操作结合起来了 >>> import json >>> c = {"name": "wang", "age": 30} >>> print(type(c)) <class ' 阅读全文
posted @ 2018-02-12 15:52 一语中的 阅读(156) 评论(0) 推荐(0) 编辑