12 2019 档案
摘要:首先是引入json 和 pickle 的原因是 普通的方法支持的数据类型太少 局限性大 比如下面的例子 dit = {'name':'deng1mei','age':'26','sex':'girl'} #创建一个字典dit = str(dit) #将字典字符串化 以方便写入文件# f= open
阅读全文
摘要:st = 'hello ketty ##$ \*'print(st.count('t'))# 输出‘t’的个数print(st.capitalize()) #Hello ketty 将首字母大写print(st.center(30,'-')) # hello ketty 将st放在30个'_'的中间
阅读全文
摘要:import configparser #配置文件config = configparser.ConfigParser()config["DEFAULT"] = {'ServerAliveInterval': '45','Compression': 'yes','CompressionLevel':
阅读全文
摘要:代码如下 1 import re 2 def form_at(string): 3 string = string.replace('++','+') 4 string = string.replace('-+','-') 5 string = string.replace('+-','-') 6
阅读全文
摘要: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:‘ . ’通
阅读全文