notes
1. beautifulsoup 获取标签内容
https://cuiqingcai.com/1319.html
2.正则匹配优先量词与忽略优先量词
https://www.cnblogs.com/nzbbody/p/4391792.html
3. 列表倒序
>>> alist = [1,4,2,3] >>> alist = alist[::-1] >>> alist [3, 2, 4, 1]
4.豆瓣API使用
>>> import requests >>> r = requests.get('https://api.douban.com/v2/movie/subject/1291546') >>> r.json() # 返回格式为json,python中方便使用需解码 {'rating': {'max': 10, 'average': 9.5, 'stars': '50', 'min': 0}, 'reviews_count': 5018, 'wish_count': 83849, 'douban_site': '', 'year': '1993', 'images': {'small': 'https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1910813120.jpg', 'large': 'https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1910813120.jpg', 'medium': 'https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1910813120.jpg'}, 'alt': 'https://movie.douban.com/subject/1291546/', 'id': '1291546', 'mobile_url': 'https://movie.douban.com/subject/1291546/mobile', 'title': '霸王别姬', 'do_count': None, 'share_url': 'https://m.douban.com/movie/subject/1291546', 'seasons_count': None, 'schedule_url': '', 'episodes_count': None, 'countries': ['中国大陆', '香港'], 'genres': ['剧情', '爱情', '同性'], 'collect_count': 863835, 'casts': [{'alt': 'https://movie.douban.com/celebrity/1003494/', 'avatars': {'small': 'https://img1.doubanio.com/view/celebrity/s_ratio_celebrity/public/p67.jpg', 'large': 'https://img1.doubanio.com/view/celebrity/s_ratio_celebrity/public/p67.jpg', 'medium': 'https://img1.doubanio.com/view/celebrity/s_ratio_celebrity/public/p67.jpg'}, 'name': '张国荣', 'id': '1003494'}, {'alt': 'https://movie.douban.com/celebrity/1050265/', 'avatars': {'small': 'https://img3.doubanio.com/view/celebrity/s_ratio_celebrity/public/p46345.jpg', 'large': 'https://img3.doubanio.com/view/celebrity/s_ratio_celebrity/public/p46345.jpg', 'medium': 'https://img3.doubanio.com/view/celebrity/s_ratio_celebrity/public/p46345.jpg'}, 'name': '张丰毅', 'id': '1050265'}, {'alt': 'https://movie.douban.com/celebrity/1035641/', 'avatars': {'small': 'https://img1.doubanio.com/view/celebrity/s_ratio_celebrity/public/p1399268395.47.jpg', 'large': 'https://img1.doubanio.com/view/celebrity/s_ratio_celebrity/public/p1399268395.47.jpg', 'medium': 'https://img1.doubanio.com/view/celebrity/s_ratio_celebrity/public/p1399268395.47.jpg'}, 'name': '巩俐', 'id': '1035641'}, {'alt': 'https://movie.douban.com/celebrity/1000905/', 'avatars': {'small': 'https://img3.doubanio.com/view/celebrity/s_ratio_celebrity/public/p46.jpg', 'large': 'https://img3.doubanio.com/view/celebrity/s_ratio_celebrity/public/p46.jpg', 'medium': 'https://img3.doubanio.com/view/celebrity/s_ratio_celebrity/public/p46.jpg'}, 'name': '葛优', 'id': '1000905'}], 'current_season': None, 'original_title': '霸王别姬', 'summary': '段小楼(张丰毅)与程蝶衣(张国荣)是一对打小一起长大的师兄弟,两人一个演生,一个饰旦,一向配合天衣无缝,尤其一出《霸王别姬》,更是誉满京城,为此,两人约定合演一辈子《霸王别姬》。但两人对戏剧与人生关系的理解有本质不同,段小楼深知戏非人生,程蝶衣则是人戏不分。\n段小楼在认为该成家立业之时迎娶了名妓菊仙(巩俐),致使程蝶衣认定菊仙是可耻的第三者,使段小楼做了叛徒,自此,三人围绕一出《霸王别姬》生出的爱恨情仇战开始随着时代风云的变迁不断升级,终酿成悲剧。©豆瓣', 'subtype': 'movie', 'directors': [{'alt': 'https://movie.douban.com/celebrity/1023040/', 'avatars': {'small': 'https://img3.doubanio.com/view/celebrity/s_ratio_celebrity/public/p1451727734.81.jpg', 'large': 'https://img3.doubanio.com/view/celebrity/s_ratio_celebrity/public/p1451727734.81.jpg', 'medium': 'https://img3.doubanio.com/view/celebrity/s_ratio_celebrity/public/p1451727734.81.jpg'}, 'name': '陈凯歌', 'id': '1023040'}], 'comments_count': 182276, 'ratings_count': 691378, 'aka': ['再见,我的妾', 'Farewell My Concubine']}
5.python单下划线的作用
https://hackernoon.com/understanding-the-underscore-of-python-309d1a029edc
6.python编码风格
官方 https://www.python.org/dev/peps/pep-0008/
google https://google.github.io/styleguide/pyguide.html
1.001^365=1.44......life is a project
原创文章,转载请注明出处!