![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
Zbuter
这个作者很懒,什么都没留下…
展开
-
服务器安装jupyter notebook
pip install jupyter jupyter notebook --generate-config #生成配置文件 生成配置文件后会显示配置文件生成路径 在该用户的家目录下的.jupyter文件夹中 vi ~/.jupyter/jupyter_notebook_config.py 将下面的文件修改为对应的值 c.NotebookApp.ip = '0.0.0.0' c....原创 2020-02-03 23:29:13 · 180 阅读 · 0 评论 -
永久更改pip源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple原创 2020-02-03 19:46:48 · 171 阅读 · 0 评论 -
Python爬虫利器二之Beautiful Soup的用法
上一节我们介绍了正则表达式,它的内容其实还是蛮多的,如果一个正则匹配稍有差池,那可能程序就处在永久的循环之中,而且有的小伙伴们也对写正则表达式的写法用得不熟练,没关系,我们还有一个更强大的工具,叫Beautiful Soup,有了它我们可以很方便地提取出HTML或XML标签中的内容,实在是方便,这一节就让我们一起来感受一下Beautiful Soup的强大吧。1. Beautiful Soup的简...转载 2018-03-06 15:36:40 · 184 阅读 · 0 评论 -
CentOS7下安装Python3及Pip3并保留Python2
环境:CentOS 71. 安装依赖环境# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel2. 浏览器打开 https://www.python.org/...转载 2018-03-31 16:55:41 · 134 阅读 · 0 评论 -
在windows写入文件中遇到 UnicodeEncodeError: ‘gbk’ codec can’t encode character 错误的解决办法
今天爬一个网站的内容,在写入文件时,某些页面总是报UnicodeEncodeError: ‘gbk’ codec can’t encode character错误,网上找了半天也没找到解决办法。后来终于找到了解决办法,十分简单:with open('dizhi.txt','w',encoding='utf-8') as f:出错的原因是网页及python的编码都是utf-8,在写进txt时Wind...原创 2018-03-27 14:48:15 · 391 阅读 · 0 评论