![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
dataDance
这个作者很懒,什么都没留下…
展开
-
python拆包
python拆包def run(a,*b): print(a) print('未拆包') print(b) print('拆包') print(*b) #等同于 c,d=*brun(1,2,3)1未拆包(2, 3)拆包2 3原创 2019-02-22 23:11:00 · 317 阅读 · 0 评论 -
Python中enumerate的用法
li=[1,2,3]en=enumerate(li)list(en)[(0, 1), (1, 2), (2, 3)]for a,b in enumerate(li): print(a,b)0 11 22 3原创 2019-02-22 23:19:26 · 310 阅读 · 0 评论 -
Python中zip的用法
zip可以将多个列表、元组或其它序列成对组合成一个元组列表:压缩seq1 = ['foo', 'bar', 'baz']seq2 = ['one', 'two', 'three']zipped = zip(seq1, seq2)list(zipped)[('foo', 'one'), ('bar', 'two'), ('baz', 'three')]解压缩e=list(zippe...原创 2019-02-22 23:37:47 · 204 阅读 · 0 评论 -
Python读文件乱码解决方法
方法1:指定编码类型encoding=?文件中的中文字符默认是以encoding='gbk’打开的,若文件编码不是gbk编码就会报错。其中a.txt编码是utf-8with open('a.txt',encoding='utf-8') as file: print(file.read())方法2:以bytes类型读取with open('a.txt','rb') as fil...原创 2019-04-05 18:22:57 · 452 阅读 · 0 评论 -
爬取boss直聘目标职位信息
import requestsfrom lxml import etreeimport pandas as pdclass spider: def __init__(self, word, begin_page, end_page): self.word = word self.begin_page = begin_page sel...原创 2019-04-21 11:58:13 · 203 阅读 · 0 评论