python
卩杉
勤学如早春之苗,不见其增,日有所长。辍学如磨刀之石,不见其减,日有所损。
展开
-
python 爬取豆瓣电影 T250
import bs4import requestsdef openURL(url): headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:58.0) Gecko/20100101 Firefox/58.0' } return requests.get(url, headers=headers)def findMovies(res): soup = bs4.Beau原创 2021-08-04 22:28:27 · 364 阅读 · 0 评论 -
python property() 使用
class C(): def __init__(self, size=10): self.size = size def getSize(self): return self.size def setSize(self, value): self.size = value def delSize(self): del self.size x = property(getSize, setSize,原创 2021-07-27 15:41:57 · 149 阅读 · 0 评论 -
ValueError: check_hostname requires server_hostname 问题解决
错误提示:ERROR: Exception:Traceback (most recent call last): File "d:\python\sdk\py3.9.5\lib\site-packages\pip\_internal\cli\base_command.py", line 180, in _main status = self.run(options, args) File "d:\python\sdk\py3.9.5\lib\site-packages\pip\_inte原创 2021-06-29 22:12:35 · 2941 阅读 · 0 评论 -
python 格式化
x = print("我的名字是%s" % "我彦祖")buf = "A = %d, B = %s " % (18, "dddd")print(buf)print("学号是%03d" % 12) # 不够 3 位自动补 0# py 3.6 之后的 f 表达式格式化name = "吴彦祖"age = 18print(f'我是{name},年轻是{age}')输出...原创 2021-06-06 22:54:43 · 115 阅读 · 0 评论