上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 50 下一页
摘要: requests。它是一个Python第三方库,处理URL资源特别方便。 GET 用with语句块通过GET访问一个网页 import requests url='https://www.python.org' with requests.get('https://www.python.org') 阅读全文
posted @ 2020-10-16 13:01 ShineLe 阅读(85) 评论(0) 推荐(0)
摘要: GET和POST请求后会返回一个response对象,可通过key、values等访问字典中元素的方式来访问该response对象headers中的各种属性 r=requests.get(url,headers={'User-Agent':'...'}) for key,value in r.hea 阅读全文
posted @ 2020-10-16 12:52 ShineLe 阅读(1320) 评论(0) 推荐(0)
摘要: 每次运行程序,比如A.py,都会额外生成一个Console,排列成一排的 A(2),A(3),... 那么如何关闭呢? 答案是:在Settings->Console中,勾选 'Use existing console for ....' 阅读全文
posted @ 2020-10-15 22:04 ShineLe 阅读(720) 评论(0) 推荐(0)
摘要: Setting中取消勾选'Use IPython if aviable' 阅读全文
posted @ 2020-10-15 22:00 ShineLe 阅读(1051) 评论(0) 推荐(0)
摘要: 背景:安装了最新版本的Anaconda3.9后,在Pycharm中设置Python Interpreter为这个最新版本Anaconda文件下的python.exe后,控制台无法启动并报错TypeError: an integer is required (got type bytes) 原因:电脑 阅读全文
posted @ 2020-10-15 20:46 ShineLe 阅读(7373) 评论(0) 推荐(0)
摘要: 比如编程时要用到Arial字体,Arial的字体绝对路径为 C:\Windows\Fonts\Arial.ttf 注意字体文件的后缀都是ttf 阅读全文
posted @ 2020-10-14 13:11 ShineLe 阅读(1153) 评论(0) 推荐(0)
摘要: 使用PIL时,创建某个字体Font对象时出错: font=ImageFont.truetype('Arial.ttf',36) 可能原因有两个: 1、PIL无法定位到字体文件的位置。 可以通过提供绝对路径解决,比如 font=ImageFont.truetype('C:\Windows\Fonts\ 阅读全文
posted @ 2020-10-14 13:06 ShineLe 阅读(2474) 评论(0) 推荐(0)
摘要: 1、% 'abc%s'%'123' 'abc123' 'abc%s%s'%('123','456') 'abc123456' 当变量v是一个Tuple、List且其中元素数量和字符串中%数量相同时,可以直接在后边写%v,例如: A=(1,2) print('A的值是%s和%s'%A) A的值是1和2 阅读全文
posted @ 2020-10-13 18:56 ShineLe 阅读(604) 评论(0) 推荐(0)
摘要: 如果in的左边是个含有多个元素的元组对象 例如 ('a','b') in L 那么L在什么情况下,这个式子会输出True呢? 答案是,L中必须也有一个和想要查找的元组一模一样的元组才行,比如: L=[('a','b') , 'c'] #True L=[ 'a' , 'b'] #False 注意必须是 阅读全文
posted @ 2020-10-13 15:03 ShineLe 阅读(1118) 评论(0) 推荐(0)
摘要: 1、集体缩进 选中代码块,按TAB 2、集体前移 选中代码块,Shift TAB 3、集体注释 选中代码块,CTRL + / 4、取消集体注释 再按一下CTRL+/ 5、集体折叠 CTRL+SHIFT+数字键旁边的-号 6、展开 CTRL+SHIFT+数字键旁边的+号 阅读全文
posted @ 2020-10-13 14:20 ShineLe 阅读(1726) 评论(0) 推荐(0)
上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 50 下一页