摘要: import openpyxl wb = openpyxl.load_workbook('example.xlsx') print(wb) <openpyxl.workbook.workbook.Workbook object at 0x000001979C39CC88> import openpy 阅读全文
posted @ 2021-04-07 22:41 Alex0425 阅读(89) 评论(0) 推荐(0) 编辑
摘要: https://docs.python.org/zh-cn/3/library/re.html https://zhuanlan.zhihu.com/p/68014839 findall,search,sub,S python findall import re str = 'aabbabaabba 阅读全文
posted @ 2020-11-30 21:28 Alex0425 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 1、计算成绩 scores = {"baidu":32,"google":78,"weixin":95,"facebook":68,"aws":94,"ali":97} for k,v in scores.items(): if(v == max(scores.values())): print(k 阅读全文
posted @ 2020-11-30 08:36 Alex0425 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 在python中,strings, tuples, 和numbers是不可更改的对象,而list,dict等则是可以修改的对象。 Python 的值传递,还是引用传递,查看下面的例子(引用传递,即传递地址): Python一定是引用传递的。 from ctypes import * import o 阅读全文
posted @ 2020-11-29 17:29 Alex0425 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 前提:Python的列表解析式 [expression for iter_var in iterable1 if condition] import random a=[random.randint(1,99) for i in range(10) if random.randint(1,99)<4 阅读全文
posted @ 2020-11-29 10:54 Alex0425 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 随机打印2个0-100之间的数字(包含0和100) 想把这些数字放到列表中的话,直接按下面的写法完成即可 这样就产生了一个随机数的列表 、 阅读全文
posted @ 2020-11-07 08:34 Alex0425 阅读(76) 评论(0) 推荐(0) 编辑
摘要: df.info() 行索引:直接返回前多少行的数据,下面示例返回前三行的数据 列索引:取字段名称,返回该列的所有值 loc取指定行指定列的数据:返回指定的index的行,指定列为age的数据,这里的0:2指的是索引,所以这里一共有三行。 iloc取指定列指定行的数据:这里的iloc前面的0:3指的是 阅读全文
posted @ 2020-11-04 21:02 Alex0425 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 可哈希的对象:(数字类型(int,float,bool)字符串str、元组tuple、自定义类的对象) 不可哈希的对象:列表,集合和字典 isinstance()可以查看该类型是否可以迭代,for循环一定要可迭代的 zip(),enumerate(),列表解析 阅读全文
posted @ 2020-11-01 16:42 Alex0425 阅读(500) 评论(0) 推荐(0) 编辑
摘要: 1、python内建函数 常用的内建函数type(),id():查看内存地址 ,ord('a') : 用于查看ASCII码;chr(97):用于查看某个ASCII码对应的字符;help(str);dir(str);hasattr('python','__iter__'):查看字符串是否可以迭代 2、 阅读全文
posted @ 2020-10-30 18:30 Alex0425 阅读(59) 评论(0) 推荐(0) 编辑
摘要: https://my.oschina.net/u/4567873/blog/4582628 https://www.cnblogs.com/sammyliu/p/10056035.html https://blog.csdn.net/qq_16240085/article/details/86612 阅读全文
posted @ 2020-09-20 11:03 Alex0425 阅读(101) 评论(0) 推荐(0) 编辑