diff --git a/001 zhihu/myzhihu.py b/001 zhihu/myzhihu.py index c21b1d2..4c3e94d 100644 --- a/001 zhihu/myzhihu.py +++ b/001 zhihu/myzhihu.py @@ -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) diff --git a/001 zhihu/zhihu.py b/001 zhihu/zhihu.py index d0b7f83..76995cd 100644 --- a/001 zhihu/zhihu.py +++ b/001 zhihu/zhihu.py @@ -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: diff --git a/003 weibo.cn/m.weibo.cn.py b/003 weibo.cn/m.weibo.cn.py index 765e2ae..f5498ac 100644 --- a/003 weibo.cn/m.weibo.cn.py +++ b/003 weibo.cn/m.weibo.cn.py @@ -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() diff --git a/003 weibo.cn/weibo.cn.py b/003 weibo.cn/weibo.cn.py index 9768356..35bebb6 100644 --- a/003 weibo.cn/weibo.cn.py +++ b/003 weibo.cn/weibo.cn.py @@ -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() diff --git a/005 webQQ/webQQ.py b/005 webQQ/webQQ.py index c9b0c72..bc81879 100644 --- a/005 webQQ/webQQ.py +++ b/005 webQQ/webQQ.py @@ -41,7 +41,6 @@ def showQRImage(): # print(type(reponse)) >>> with open(QRImgPath, 'wb') as f : f.write(reponse.content) - f.close() if sys.platform.find('darwin') >= 0: subprocess.call(['open', QRImgPath]) diff --git a/006 webWeixin/webWeixin.py b/006 webWeixin/webWeixin.py index 5de3d96..ff25c60 100644 --- a/006 webWeixin/webWeixin.py +++ b/006 webWeixin/webWeixin.py @@ -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]) diff --git a/007 weibo.com/weibo.com.py b/007 weibo.com/weibo.com.py index 20d9914..169d9a9 100644 --- a/007 weibo.com/weibo.com.py +++ b/007 weibo.com/weibo.com.py @@ -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() diff --git a/007 weibo.com/weibo.qrcode.py b/007 weibo.com/weibo.qrcode.py index 4bbe12f..7dfa301 100644 --- a/007 weibo.com/weibo.qrcode.py +++ b/007 weibo.com/weibo.qrcode.py @@ -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 diff --git a/019 bilibili/bilibili.py b/019 bilibili/bilibili.py index e0ddc47..5f80db3 100644 --- a/019 bilibili/bilibili.py +++ b/019 bilibili/bilibili.py @@ -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: