
Python
dendysan
Loading......
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Python pip使用国内镜像进行加速
使用window自带的文本编辑器编辑配置文件pip config --editor C:\WINDOWS\system32\notepad.exe edit内容如下[global]index-url = https://pypi.tuna.tsinghua.edu.cn/simple#proxy = http://XXXX.com:port index-url是国内清华镜像源proxy 代理,按照网络实际配置修改即可pip版本:使用命令查询pip -V...原创 2020-11-18 15:56:33 · 272 阅读 · 0 评论 -
python安装成功pywin32以后仍旧提示找不到模块
pip install pywin32将python安装目录下的python\Lib\site-packages\pywin32_system32的pythoncom35.dll和pywintypes35.dll粘贴复制到C:\Windows\System32目录下————————————————版权声明:本文为优快云博主「MJJDMW」的原创文章,遵循 CC 4.0 BY-SA 版权协...转载 2019-11-09 14:00:35 · 7023 阅读 · 3 评论 -
Python3 logging自定义 Logger
import loggingimport logging.handlerslogging.basicConfig(level = logging.DEBUG,format = '%(asctime)s -%(name)s- %(filename)s[line:%(lineno)d] - %(levelname)s - %(message)s')logger = logging.getLogg...原创 2019-07-18 15:46:15 · 898 阅读 · 0 评论 -
Django2.2 UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa6 in position 9737
win7python 3.6.4Django 2.2During handling of the above exception, another exception occurred:Traceback (most recent call last): File "C:\Users\YYYW\AppData\Local\Programs\Python\Python36\lib\ws...原创 2019-06-05 11:28:32 · 972 阅读 · 2 评论 -
python判断变量是否为int、字符串、列表、元组、字典等方法
from : https://www.cnblogs.com/fmgao-technology/p/9065753.html在实际写程序中,经常要对变量类型进行判断,除了用type(变量)这种方法外,还可以用isinstance方法判断:#!/usr/bin/env pythona = 1b = [1,2,3,4]c = (1,2,3,4)d = {‘a‘:1,‘b‘:2,‘c‘:3}...原创 2019-04-23 11:21:57 · 310 阅读 · 0 评论 -
Python 中的 if __name__ == '__main__' 该如何理解
原创 2019-01-28 16:12:32 · 142 阅读 · 0 评论 -
Python在不同层级目录import模块的方法
python在不同层级目录import模块的方法使用python进行程序编写时,经常会使用第三方模块包。这种包我们可以通过python setup install 进行安装后,通过import XXX或from XXX import yyy 进行导入。不过如果是自己遍写的依赖包,又不想安装到python的相应目录,可以放到本目录里进行import进行调用;为了更清晰的理清程序之间的关系,例如我们...原创 2019-01-18 10:23:39 · 403 阅读 · 0 评论 -
Python : except Exception,e: ^ SyntaxError: invalid syntax
File "F:/jxxxxxxxxxxx/xxxxxxx/xxxxxx/xxxx.py", line 30 except Exception,e: ^SyntaxError: invalid syntaxYou should have written except getopt.GetoptError as e:instead of exce...原创 2019-01-18 10:16:13 · 4622 阅读 · 0 评论 -
Python :Error: “ 'dict' object has no attribute 'iteritems' ”
abcdPython2dict.iteritems()dict.iterkeys()dict.itervalues().Python3dict.items()dict.keys()dict.values()原创 2019-01-18 09:52:53 · 1465 阅读 · 0 评论 -
Python : Unicode-objects must be encoded before hashing
# hashlib.md5(data)函数中,data参数的类型应该是bytes # Unicode-objects must be encoded before hashing(hash前必须把数据转换成bytes类型)>>> from hashlib import md5 File "<stdin>", line 1, in <module> &...原创 2019-01-18 09:51:15 · 892 阅读 · 0 评论 -
Python : 'module' has no attribute 'urlencode'
urllib has been split up in Python 3. The urllib.urlencode() function is now urllib.parse.urlencode(), and the urllib.urlopen() function is now urllib.request.urlopen()soabcPython2urllib...原创 2019-01-18 09:49:34 · 388 阅读 · 0 评论 -
CentOS && Vim 配置(python版)Vundle YouCompleteMe
安装python 3.7.1详见 https://blog.youkuaiyun.com/weixin_38111667/article/details/84772659安装vim8详见 https://blog.youkuaiyun.com/weixin_38111667/article/details/84774571安装VundleVundle是Vim的插件管理工具之一,官方文档:https://g...原创 2018-12-03 20:41:08 · 294 阅读 · 0 评论 -
Python && Python将dict中的unicode打印成中文
import jsona = {u'content': {u'address_detail': {u'province': u'\u5409\u6797\u7701', u'city': u'\u957f\u6625\u5e02', u'street_number': u'', u'district': u'', u'street': u'', u'city_code': 53}, u'poi...原创 2018-12-03 19:09:27 · 513 阅读 · 0 评论 -
CentOS && Python3 CentOS编译安装vim8并支持python3
CentOS &amp;amp;amp;&amp;amp;amp; Python3 CentOS编译安装vim8并支持python31.检查旧vim版本,卸载旧版本安装最新vim8vimyum -y remove vim*2.获取源码编译安装vim8安装依赖yum -y install ncurses-devel安装vim8(我只使用python3,所以.configure配置是我自己的配置)./config...原创 2018-12-03 17:24:09 · 508 阅读 · 0 评论 -
Centos 7 && Python 安装python3并与python2共存
Centos 7 &amp;amp;amp;&amp;amp;amp; Python 安装python3并与python2共存1.查看是否已经安装PythonCentOS 7.2 默认安装了python2.7.5 因为一些命令要用它比如yum 它使用的是python2.7.5。使用 python -V 命令查看一下是否安装Pythonpython -VPython 2.7.5然后使用命令 which pyth...原创 2018-12-03 16:53:59 · 208 阅读 · 0 评论 -
Python && 微信企业号发送消息脚本
#!/usr/local/python3/bin/python3#-*- coding:utf-8 -*-import requestsimport jsonimport sysimport os#企业号及应用相关信息corp_id='wwe0xxxxxxxxc2d7xxxa28xxf790c7'corp_secret='GNx-afsJ29xxQxxxQQhJLx_-x'ag...原创 2018-09-29 20:05:26 · 1541 阅读 · 0 评论