![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
Forget December
这个作者很懒,什么都没留下…
展开
-
各种乱码原因分析
最近在即刻中发现一名用户发了一张乱码原因整理的表格,感觉非常有用,就分享给大家原创 2020-12-30 20:40:00 · 225 阅读 · 0 评论 -
简单爬虫入门
# get请求 import urllib.request if __name__ == "__main__": response = urllib.request.urlopen("http://www.baidu.com") print(response.read().decode('utf-8')) # post请求 import urllib.request if __name__ == "__main__": data = bytes(urllib.parse.原创 2020-12-27 15:34:25 · 121 阅读 · 2 评论 -
python爬虫获取豆瓣电影top250的名字
最近面试了一个爬虫实习岗位,不知道能不能过,先学习一下爬虫练练手. import re import urllib.request import urllib.error def get_douban_pages(): index = 1 # 电影排名 # 伪装成浏览器 header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/201001原创 2020-12-27 15:06:21 · 692 阅读 · 3 评论 -
python中的两种拆包演示
注:以下操作是在python控制台下执行的 *拆包 元组中的拆包 t=(1,2,3) print(t) (1, 2, 3) print(*t) 1 2 3 函数中的拆包 def test(a,*args): ... print(a) ... print(args) ... print(*args) ... test(1,2,3,4,5) 1 (2, 3, 4, 5) 2 3 4 5 test(1,(2,3,4,5)) 1 ((2, 3, 4, 5),) (2, 3, 4, 5)原创 2020-11-13 16:36:50 · 195 阅读 · 0 评论 -
python常用命名规范
python常用命名规范 1.模块 模块尽量使用小写命名,首字母保持小写,尽量不要用下划线(除非多个单词,且数量不多的情况) # 正确的模块名 import decoder import html_parser # 不推荐的模块名 import Decoder 2、类名 类名使用驼峰(CamelCase)命名风格,首字母大写,私有类可用一个下划线开头 class Farm(): class AnimalFarm(Farm): class _PrivateFarm(Farm): 将相关的类和顶原创 2020-11-12 13:33:28 · 214 阅读 · 0 评论 -
Django模型查询方法总结
增删改 # 增删改 # 增加和改动时要注意save() # user=User() # user.name='Steve' # user.password='123' # user.email='456456@qq.com' # user.birthday=datetime.today() # user.save() # user=User.objects.get(name='Steve') # user.delete()原创 2020-10-24 09:47:04 · 445 阅读 · 1 评论