![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
ty_xiumud
有些时候,不是因为看到了希望才去坚持,而是坚持了,才看到希望。
展开
-
python_1(初试旅游站点)
from bs4 import BeautifulSoupimport requestsurl = "https://harbin.cncn.com/jingdian/"web_data = requests.get(url)soup = BeautifulSoup(web_data.text,'lxml')titles = soup.select('div.title > b...原创 2019-02-18 23:11:20 · 431 阅读 · 0 评论 -
猫眼top前100电影爬取demo(正则初试)
import jsonimport requestsimport redef get_one_page(url): response = requests.get(url) if response.status_code == 200: return response.text else: return Nonedef pars...原创 2019-03-04 20:52:58 · 437 阅读 · 0 评论 -
如何理解 if __name__ == “__main__“:
本文摘录自知友凌孜侵删很多时候会在Python中遇见if __name__ == "__main__":其本意是什么指定Python程序运行的入口,而不执行其下包含的指令。看下面一个例子我们编写两个.py文件# file one.pydef func(): print("func() in one.py")print("top-level in one.py")print("one.py's __name__ is ",__name__)if __name__ == "__ma.原创 2021-09-08 23:57:53 · 586 阅读 · 0 评论