
python
想你时的孤独
这个作者很懒,什么都没留下…
展开
-
python3切割圆形图片
原图:变化后:import osfrom PIL import Image#圆形头像def circle(img_path): path_name = os.path.dirname(img_path) cir_file_name = 'cir_img.png' cir_path = path_name + '/' + cir_file_name...原创 2020-01-07 16:46:05 · 5189 阅读 · 1 评论 -
python3截取图片
import osfrom PIL import Imagedef cut_img(img_path): # 打开一张图 img = Image.open(img_path) # 图片尺寸 img_size = img.size img_h = img_size[1] # 图片高度 img_w = img_size[0] # 图片宽度...原创 2020-01-07 16:21:58 · 968 阅读 · 0 评论 -
python No module named 'urlparse'
1、ModuleNotFoundError: No module named 'urllib2'在python3.x版本中,urllib和urllib2包集合成在一个包了import urllib2response = urllib2.urlopen(request)改为import urllib.requestresponse = urllib.request.urlopen("h...转载 2018-09-06 14:44:30 · 17693 阅读 · 0 评论 -
SyntaxError: Non-ASCII character '\xe6' in file
python默认编码是ASCII,你在脚本里加注释是中文的话会报这个错,只需要在脚本开头加上#coding=utf-8原创 2018-09-06 17:37:12 · 780 阅读 · 0 评论 -
python更新MySQL提示Truncated incorrect DOUBLE value
错误写法:update data set status=1,raw_data=%s,updatetime=%d where signature=%s and status=3" % (response,time_t,token)正确写法:update data set status=1,raw_data='%s',updatetime=%d where sig...原创 2018-09-06 17:40:07 · 1818 阅读 · 0 评论 -
ubuntu14.04 升级python3.4到3.6
sudo add-apt-repository ppa:jonathonf/python-3.6sudo apt-get updatesudo apt-get install python3.6sudo rm /usr/bin/python3sudo ln -s /usr/bin/python3.6 /usr/bin/python3install pip for pyt...转载 2019-09-26 11:32:21 · 1896 阅读 · 0 评论