摘要: https://blog.csdn.net/Y601343678/article/details/78585728 p> 如何获得系统的默认编码? #!/usr/bin/env python #coding=utf-8 import sys printsys.getdefaultencoding() 阅读全文
posted @ 2019-07-22 23:39 挑水工 阅读(576) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pyplot as plt import numpy as np x = np.arange(-10,11,1) y = x * x plt.plot(x,y) plt.text(0,40,'fanctio:y=x*x') plt.text(0,20,'fanctio:y=x*x') plt.show() # # Autogenerated by bo... 阅读全文
posted @ 2019-07-11 22:47 挑水工 阅读(308) 评论(0) 推荐(0) 编辑
摘要: 2.更改日期 阅读全文
posted @ 2019-07-11 22:13 挑水工 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 1 import matplotlib.pyplot as plt 2 import matplotlib as mp1 3 import numpy as np 4 import datetime 5 fig = plt.figure() 6 star = datetime.datetime(2015,1,1) 7 stop = datetime.datetime(2016,1... 阅读全文
posted @ 2019-07-11 07:08 挑水工 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 1 import matplotlib.pyplot as plt 2 import numpy as np 3 x = np.arange(-10,11,1) 4 y = x*x 5 plt.plot(x,y) 6 plt.annotate('shis is the bootm', 7 xy=(0 阅读全文
posted @ 2019-07-11 06:21 挑水工 阅读(180) 评论(0) 推荐(0) 编辑
摘要: import os filedir = os.getcwd() + "\\微信文章\\四大名著" print(filedir) filenames = os.listdir(filedir) print(filenames) file=open('文件目录.txt','w',encoding="utf-8") # #向文件中写入字符 # # #先遍历文件名 for filename in f... 阅读全文
posted @ 2019-06-26 06:42 挑水工 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Python常用模块大全(总结) hashlib,md5模块: hashlib.md5(‘md5_str‘).hexdigest() 对指定字符串md5加密 md5.md5(‘md5_str‘).hexdigest() 对指定字符串md5加密 Python常用模块大全(总结) random模块: r 阅读全文
posted @ 2019-06-02 18:38 挑水工 阅读(292) 评论(0) 推荐(0) 编辑
摘要: str.capitalize() 把字符串的第一个字符大写 str.center(width) 返回一个原字符串居中,并使用空格填充到width长度的新字符串 str.ljust(width) 返回一个原字符串左对齐,用空格填充到指定长度的新字符串 str.rjust(width) 返回一个原字符串右对齐,用空格填充到指定长度的新字符串 str.zfill(width) 返回字符串右对齐,前面用... 阅读全文
posted @ 2019-06-02 18:34 挑水工 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 一.常用正则表达式符号和语法: '.' 匹配所有字符串,除\n以外 ‘-’ 表示范围[0-9] '*' 匹配前面的子表达式零次或多次。要匹配 * 字符,请使用 \*。 '+' 匹配前面的子表达式一次或多次。要匹配 + 字符,请使用 \+ '^' 匹配字符串开头 ‘$’ 匹配字符串结尾 re '\' 转义字符, 使后一个字符改变原来的意思,如果字符串中有字符*需要匹配,可以\*或者字符集[*] r... 阅读全文
posted @ 2019-06-02 18:33 挑水工 阅读(117) 评论(0) 推荐(0) 编辑
摘要: ceil:取大于等于x的最小的整数值,如果x是一个整数,则返回x copysign:把y的正负号加到x前面,可以使用0 cos:求x的余弦,x必须是弧度 degrees:把x从弧度转换成角度 e:表示一个常量 exp:返回math.e,也就是2.71828的x次方 expm1:返回math.e的x(其值为2.71828)次方的值减1 fabs:返回x的绝对值 factorial:取x的阶乘的值 ... 阅读全文
posted @ 2019-06-02 18:29 挑水工 阅读(110) 评论(0) 推荐(0) 编辑