![](https://img-blog.csdnimg.cn/20190918140053667.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
python
python
persistenthuang
☞
展开
-
Python笔记-基础-01
python笔记:基础语法:定义字符串 str='内容' str="内容" str='''内容可以换行''' str=f'{占位符}'打印函数: print(‘语句’)强制类型转换: int() str() float() bytes() bool() complex()测量长度函数: len()字符串函数: 转换为大写 str.upper()...原创 2020-01-19 14:52:46 · 105 阅读 · 0 评论 -
python笔记-报错-02
python所谓万物皆有源,所有的编程语言都是为了 实现功能所发明出来的,追根到底所有的编程语言最终都是解决的数学问题,且大部分编程语言都有共同点的。触类旁通。接下来记录我学习过程中遇到的问题。IndentationError:unindent does not match any outer indentation level缩进错误:这类错误产生主要是由于python语言的语法缩进t...原创 2020-03-04 13:56:52 · 131 阅读 · 0 评论 -
python笔记-基础-06
python笔记环境变量编写配置文件时一些参数的储存位置,在目录下建立一个 “.env” 文件储存的是以键值对的形式存在的例如:password = ***********name = persistenthaung然后在其他的程序中调用时方法示例如下:from dotenv import load_dotenvload_dotenv()import ospassword=os.getenv('password')print(password)运行出现的报错:#如果原创 2020-05-13 11:58:02 · 750 阅读 · 0 评论 -
python笔记-基础-04
python笔记异常处理try: x=20 y=0 print(x/y)except BaseException as a: print(str(a))finally: print('this is a test')if in 语句# if语句country='abc'if country.lower()=='China': print('you are Chinese')elif country.lower() in {'usa','a原创 2020-05-12 15:21:00 · 93 阅读 · 0 评论 -
python笔记-基础-05
python笔记模块、包在一个目录下建立一个helpers,py文件、内容:def display(massage,is_waring=False): if is_waring: print('this is waring') print('massage')同一文件下建立新文件:#三种导入方式:(代码执行效率都一样)import helpershelpers.display('simpmassage',True)from helpers import原创 2020-05-12 22:36:16 · 153 阅读 · 0 评论 -
python笔记-基础-07
格式化 Linting:def print_hello(name:str): print('my name is '+name) print_hello('huang yao hui')lambda:presenters=[ {'name':'aaa','age':50}, {'name':'bbb','age':40}]presenters.sort(key=lambda parameter_list: parameter_list['age'])prin原创 2020-06-05 12:19:46 · 122 阅读 · 0 评论 -
python笔记-基础-03
python笔记基础知识:原创 2020-05-09 14:46:50 · 138 阅读 · 0 评论 -
python笔记-爬取猎聘网招聘信息
文章目录原创 2020-10-18 11:45:36 · 5834 阅读 · 0 评论 -
python笔记-爬取豆瓣Top250排行
文章目录python爬虫环境准备UrllibBeautifulSoup正则表达式获取数据解析数据python爬虫网络爬虫:按照一定规则,自动抓取互联网信息的程序或者脚本环境准备导入包配置import sysfrom bs4 import BeautifulSoup # 网页解析,获取数据import re # 正则表达式,进行文字匹配import urllib.request, urllib.error # 制定URl,获取网页数据import xlwt # 进行excel原创 2020-10-07 11:05:53 · 1244 阅读 · 0 评论 -
python笔记-爬虫-04
python笔记ProxyHandler处理器(代理设置)在使用爬虫的时候,一个IP访问太快,会被加入和名单。使用代理使用ProxyHandler构建一个 handler使用handler创建一个opener使用opener发送请求查看本地IP的网址:http://www.httpbin.org/ip#encodeing : utf-8from urllib import requesturl='http://www.httpbin.org/ip'# 不使用代原创 2020-05-20 22:24:08 · 108 阅读 · 0 评论 -
python笔记-爬虫-03
python笔记urllib原创 2020-05-16 23:18:59 · 119 阅读 · 0 评论 -
python笔记-爬虫-02
python笔记原创 2020-05-13 22:15:44 · 122 阅读 · 0 评论 -
python笔记-爬虫-01
Requests库两个重要的对象:ResponseRequestget()获得一个网页最简单方法:requests.get(url)Response对象:属性:编码:爬取网页的通用代码:HTTP协议Request主要方法:...原创 2020-03-04 13:57:30 · 105 阅读 · 0 评论