python
weixin_40530363
这个作者很懒,什么都没留下…
展开
-
python运算符
双斜杠(//)表示地板除,即先做除法(/),然后向下取整(floor)。至少有一方是float型时,结果为float型;两个数都是int型时,结果为int型转载 2018-12-21 11:23:24 · 53 阅读 · 1 评论 -
关于切片的拷贝用法的意义
store = [[]]for i in range(1, 10):for s in store[:]: #注意此处用store[:]不然会产生并发错误导致数据一直增加if len(s) < k:store.append(s + [i])store = [x for x in store if len(x) == k]store = [x for x in stor...原创 2019-06-14 11:03:39 · 159 阅读 · 0 评论 -
urlib.parse解码
a = ‘’‘2013\u5e744\u670810\u65e5’’’end = urllib.parse.unquote(a)print(end)原创 2019-07-02 17:00:31 · 137 阅读 · 0 评论 -
python二进制、八进制、十进制、十六进制的转换
转载 2019-07-15 12:51:53 · 134 阅读 · 0 评论 -
python ascii码转换
ord(): 对应字符的ascii码chr(): 与ord对立‘a-z’:97~122‘A-Z’:65~90’ ':32‘0-9’:48~57原创 2019-07-06 09:30:24 · 4288 阅读 · 0 评论 -
python检测字符串中是否有字母
str.isalpha()转载 2019-07-06 09:58:33 · 9686 阅读 · 2 评论 -
python2,python3同时安装windows
https://blog.csdn.net/qq_24373725/article/details/79638932转载 2019-07-18 17:05:10 · 75 阅读 · 0 评论 -
指定pip包导入特定位置
pip install -t /usr/local/lib/python2.7/site-packages/ xlrd转载 2019-07-12 16:07:52 · 314 阅读 · 0 评论 -
pytho查看内存使用
import os,psutilprocess = psutil.Process(os.getpid())print(‘Used Memory:’,process.memory_info().rss / 1024 / 1024,‘MB’)转载 2019-07-19 17:44:51 · 88 阅读 · 0 评论 -
python定义无穷大及无穷小
_max = float(‘inf’)_min = float(’-inf’)原创 2019-08-09 14:41:40 · 1567 阅读 · 0 评论 -
两个list的交集
list(set(a).intersection(set(b)))原创 2019-05-29 13:01:03 · 716 阅读 · 0 评论 -
time\datetime模块秒数与年月日格式的转换
import timetimeArray = time.localtime(1525132800)res = time.strftime(’%Y-%m-%d’, timeArray)print(res)原创 2019-06-06 14:35:44 · 498 阅读 · 0 评论 -
python报错
1、pandas.read_csv() 报错 OSError: Initializing from file failedengine = ‘python’原创 2019-02-25 17:09:17 · 90 阅读 · 0 评论 -
python过滤掉某个英文特殊字符
原创 2019-02-25 19:33:46 · 703 阅读 · 0 评论 -
python中set中add函数
set.add函数不是按照添加时的循序添加的,是无序的,当set中有相同元素时不添加,set内元素唯一原创 2019-02-25 20:57:11 · 3822 阅读 · 1 评论 -
使用正则表达式re去除或匹配特殊字符
re.sub(’[\t$\n\r]’,",x) 以上参数分别为匹配的模式、替换为什么值、操作数。原创 2019-02-25 22:17:06 · 5010 阅读 · 0 评论 -
groupby与agg的用法
以上对用户数据分别求出他们消费金额的平均、最大、最小、众数、次数。原创 2019-02-26 11:08:25 · 2123 阅读 · 0 评论 -
python获取两个list的交集、并集、差集
https://blog.csdn.net/m62484/article/details/70243335转载 2019-03-18 21:28:10 · 92 阅读 · 0 评论 -
将形如'[1,2]'的数组字符串转化为[1,2]
line = ‘[1,2]’list(map(int,line[1:len(line)-2].split(’,’)))原创 2019-03-26 15:19:44 · 2832 阅读 · 0 评论 -
python数组并集交集补集
https://www.cnblogs.com/TTyb/p/6283539.html转载 2019-04-06 13:23:43 · 451 阅读 · 0 评论 -
datetime模块某个时间的后一天、前一天
delta = datetime.timedelta(days=1)old = datetime.datetime(2018, 8, 2)new = (old + delta).strftime(’%Y%m%d’)print(new)原创 2019-06-12 14:39:48 · 3091 阅读 · 0 评论 -
python创建指定大小的多维数组
n = 2m = 3k = 4matrix = [None] * 2for i in range(len(matrix)): matrix[i] = [0] * 3print(matrix)for i in range(n): for j in range(m): matrix[i][j] = [1] * kprint(matrix)原创 2019-08-30 15:41:42 · 5545 阅读 · 0 评论