Skip to content
This repository has been archived by the owner on Jul 13, 2019. It is now read-only.

remove f.close() #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion 001 zhihu/myzhihu.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
captcharesponse = session.get(url=captchaurl, headers=headers)
with open('checkcode.gif', 'wb') as f:
f.write(captcharesponse.content)
f.close()
# os.startfile('checkcode.gif')
captcha = input('请输入验证码:')
print(captcha)
Expand Down
1 change: 0 additions & 1 deletion 001 zhihu/zhihu.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def get_captcha():
r = session.get(captcha_url, headers=headers)
with open('captcha.jpg', 'wb') as f:
f.write(r.content)
f.close()
# 用pillow 的 Image 显示验证码
# 如果没有安装 pillow 到源代码所在的目录去找到验证码然后手动输入
try:
Expand Down
1 change: 0 additions & 1 deletion 003 weibo.cn/m.weibo.cn.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def login_pre(username):
capt_base64 = capt_json['data']['image'].split("base64,")[1]
with open('capt.jpg', 'wb') as f:
f.write(base64.b64decode(capt_base64))
f.close()
im = Image.open("capt.jpg")
im.show()
im.close()
Expand Down
1 change: 0 additions & 1 deletion 003 weibo.cn/weibo.cn.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def get_cha(capId):
cha = session.get(cha_url, headers=headers)
with open('cha.jpg', 'wb') as f:
f.write(cha.content)
f.close()
try:
im = Image.open('cha.jpg')
im.show()
Expand Down
1 change: 0 additions & 1 deletion 005 webQQ/webQQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def showQRImage():
# print(type(reponse)) >>> <class 'requests.models.Response'>
with open(QRImgPath, 'wb') as f :
f.write(reponse.content)
f.close()

if sys.platform.find('darwin') >= 0:
subprocess.call(['open', QRImgPath])
Expand Down
1 change: 0 additions & 1 deletion 006 webWeixin/webWeixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def showQRImage():

with open(QRImgPath, 'wb') as f:
f.write(response.content)
f.close()

if sys.platform.find('darwin') >= 0:
subprocess.call(['open', QRImgPath])
Expand Down
1 change: 0 additions & 1 deletion 007 weibo.com/weibo.com.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def get_cha(pcid):
cha_page = session.get(cha_url, headers=headers)
with open("cha.jpg", 'wb') as f:
f.write(cha_page.content)
f.close()
try:
im = Image.open("cha.jpg")
im.show()
Expand Down
1 change: 0 additions & 1 deletion 007 weibo.com/weibo.qrcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def get_qrcode():
image_name = u"cha." + cha_page.headers['content-type'].split("/")[1]
with open(image_name, 'wb') as f:
f.write(cha_page.content)
f.close()
return image_name, qrcode_qrid


Expand Down
1 change: 0 additions & 1 deletion 019 bilibili/bilibili.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def get_vdcode():
r = session.get(captcha_url)
with open('captcha.jpg', 'wb') as f:
f.write(r.content)
f.close()
# 用pillow 的 Image 显示验证码
# 如果没有安装 pillow 到源代码所在的目录去找到验证码然后手动输入
try:
Expand Down