12 2019 档案

摘要:首先是引入json 和 pickle 的原因是 普通的方法支持的数据类型太少 局限性大 比如下面的例子 dit = {'name':'deng1mei','age':'26','sex':'girl'} #创建一个字典dit = str(dit) #将字典字符串化 以方便写入文件# f= open 阅读全文
posted @ 2019-12-20 14:54 ComeIntoBud 阅读(179) 评论(0) 推荐(0) 编辑
摘要:st = 'hello ketty ##$ \*'print(st.count('t'))# 输出‘t’的个数print(st.capitalize()) #Hello ketty 将首字母大写print(st.center(30,'-')) # hello ketty 将st放在30个'_'的中间 阅读全文
posted @ 2019-12-16 21:49 ComeIntoBud 阅读(502) 评论(0) 推荐(0) 编辑
摘要:import configparser #配置文件config = configparser.ConfigParser()config["DEFAULT"] = {'ServerAliveInterval': '45','Compression': 'yes','CompressionLevel': 阅读全文
posted @ 2019-12-16 20:51 ComeIntoBud 阅读(117) 评论(0) 推荐(0) 编辑
摘要:代码如下 1 import re 2 def form_at(string): 3 string = string.replace('++','+') 4 string = string.replace('-+','-') 5 string = string.replace('+-','-') 6 阅读全文
posted @ 2019-12-14 22:47 ComeIntoBud 阅读(295) 评论(0) 推荐(0) 编辑
摘要:import re s = 'hello world'a = s.find('h')print(a)p = s.replace('l', 'xx')print(p)b = s.split('w')print(b) ###############################元字符 1:‘ . ’通 阅读全文
posted @ 2019-12-06 19:13 ComeIntoBud 阅读(641) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示