
python
尹天仇沙雕
没事学学编程
展开
-
正则表达式[] {} ()学习
正则表达式的() [] {}有不同的意思。() 是为了提取匹配的字符串。表达式中有几个()就有几个相应的匹配字符串。(\s*)表示连续空格的字符串。[]是定义匹配的字符范围。比如 [a-zA-Z0-9] 表示相应位置的字符要匹配英文字符和数字。[\s*]表示空格或者*号。{}一般用来表示匹配的长度,比如 \s{3} 表示匹配三个空格,\s{1,3}表示匹配一到三个空格。(0-9) 匹配 ...转载 2018-10-18 15:10:30 · 3946 阅读 · 0 评论 -
《Python编程:从入门到实践》——学习之前
我是小白,记录一下心得(大神别喷我,哈哈)为了学习Python,前后试了IDEL,vim,notepad+,Sublime text3,Pycharm,visual studio code,以及纠结于系统Windows和Ubuntu18.04选择。感受总结一下:1、专注于Python学习。电脑系统都OK,有大神会推荐小白使用Linux。但如果使用Ubuntu,会运行python程序即可...原创 2018-10-25 17:22:41 · 176 阅读 · 0 评论 -
BeautifulSoup4----TypeError: object of type 'Response' has no len()
Issue: when I try to execute the script, BeautifulSoup(html, ...) gives the error message "TypeError: object of type 'Response' has no len(). I tried passing the actual html as a parameter, but it sti...转载 2018-12-02 20:34:09 · 1766 阅读 · 1 评论 -
爬取网页,class中有空格
当html的标签中带有多个class时,如下: div class=’content-list latest-content’ div class=’content-list hot-content’如何能利用soup.select选择出准确的div?在带有空格的class中,是含有两个class,如果soup.select(“div.content-list”),那么会...转载 2018-12-02 21:08:07 · 3879 阅读 · 0 评论 -
实战:爬取7天天气预报
利用python+request+bs4爬取7天的天气预报信息为了熟练掌握静态页面信息爬取,几种方法如下所示,希望大神指点。#!/usr/bin/env python3#-*- coding:utf-8 -*-import requestsimport refrom bs4 import BeautifulSoupurl = 'http://www.weather.com.cn/...原创 2018-12-09 22:22:18 · 2030 阅读 · 0 评论 -
python爬虫-爬取社区论坛房产信息-01
写了一个小程序,获取社区(青阳县论坛)房产信息,琢磨着房产信息能不能获得有价值的信息呢?后续分析分析#!/usr/bin/env python3#-*- conding:utf-8 -*-''' 输入页面数->采集每个页面的售房信息 版本2:函数 注意点:命名规则、函数式编程、异常处理'''import csvimport requestsimpor...原创 2019-06-04 16:58:48 · 554 阅读 · 0 评论