- 博客(7)
- 收藏
- 关注
原创 【自学Python】泡菜存储
pickle永久存储pickle.dump(obj, file, [,protocol])注解:将对象obj保存到文件file中去。 protocol为序列化使用的协议版本,0:ASCII协议,所序列化的对象使用可打印的ASCII码表示; 1:老式的二进制协议;2:2.3版本引入的新二进制协议,较以前的更高效。其中协议0和1兼容老版本的python。protocol默认值为0。 file:对象保存到的类文件对象。file必须有write()接口, file可以是一个以’w’方式打开的
2021-11-15 21:27:21
461
原创 【自学Python】文件
文件Character Meaning‘r’open for reading (default)‘w’open for writing, truncating the file first‘x’create a new file and open it for writing‘a’open for writing, appending to the end of the file if it exists‘b’binary mode‘t’tex
2021-11-15 14:46:46
126
原创 【自学Python】字典
字典>>> y={'vookii':'Me','kiki':'notme'}>>> type(y)<class 'dict'>>>> y['vookii']'Me'>>> y['civy']='cy'>>> y{'vookii': 'Me', 'kiki': 'notme', 'civy': 'cy'}"6种方法写字典">>> a={'vookii': 'Me', 'k
2021-11-06 22:56:44
444
原创 【自学Python】序列
序列'is和is not判断是否是同一个函数'>>> x='123'>>> y='123'>>> x is yTrue>>> x=[1,2,3]>>> y=[1,2,3]>>> x is yFalse'in 和 not in判断B是不是在A里面'>>> "1" in "1,2,3"True>>> "1"not in "1,2,3"Fal
2021-11-06 17:13:59
312
原创 【自学Python】字符串02
字符串02去除留白>>> " 左侧去除留白".lstrip()'左侧去除留白'>>> "右侧去除留白 ".rstrip()'右侧去除留白'>>> " 左右不要留白 ".strip()'左右不要留白'去除char字符>>> "www.google.com".lstrip("wcom")'.google.com'>>> "www.google.com".lstrip(".wc
2021-11-06 11:06:04
485
原创 在word/WPS中优雅展现的代码
在我们日常记录自己的程序时,总是会遇到本来编译时非常优美的程序复制到word或者WPS里面时,总是会非常杂乱无章,这时我们会搜寻各种方法使自己的程序beautiful again,接下来的两种方法是我提供给大家便利的方法。``...
2021-11-03 23:54:29
4342
1
原创 【自学Python】字符串01
字符串01x=‘i love U’x.casefold()‘i love u’//全部变小写x‘i love U’x.title()‘I Love U’//首字母大写x.swapcase()‘I LOVE u’//大写变小写,小写变大写x.lower()‘i love u’//全部变小写x.center(3)‘i love U’//三个字节居中x.center(20)’ i love U ’//20字节居中x.ljust(20)‘i love
2021-11-03 19:01:32
219
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅