
python
shuifa2008
喜欢计算机,喜欢编程。
展开
-
pycharm 本项目代码跳转
pycharm 本项目代码跳转原创 2023-03-07 12:00:57 · 822 阅读 · 0 评论 -
python3 filter问题
给定下面一段过滤列表的代码def filterKeyList(key_list, src_list): for key in key_list: #print(key) src_list = filter(lambda x: key in x, src_list) return src_listsrc_list = ['what are you nong', 'what are you nong sha lie ', 'your what name please', 'w原创 2022-04-28 19:38:17 · 1317 阅读 · 0 评论 -
python : 'builtin_function_or_method' object is unsubscriptable
','.join(retinfo)写成了','.join[retinfo]原创 2018-05-23 20:04:31 · 11494 阅读 · 0 评论 -
Python.h: No such file or directory
cent-os上安装uWSGI时报错[thread 0][gcc -pthread] core/dot_h.o [thread 0][gcc -pthread] core/config_py.o * uWSGI compiling embedded plugins * [thread 0][gcc -pthread] plugins/python/python_plugin.o In fil原创 2017-03-02 20:51:07 · 3053 阅读 · 0 评论 -
Python的GIL是什么鬼,多线程性能究竟如何
原文地址:http://cenalulu.github.io/python/gil-in-python/ GIL是什么首先需要明确的一点是GIL并不是Python的特性,它是在实现Python解析器(CPython)时所引入的一个概念。就好比C++是一套语言(语法)标准,但是可以用不同的编译器来编译成可执行代码。有名的编译器例如GCC,INTEL C++,Visual C++等。Python也一样转载 2017-02-21 20:34:33 · 691 阅读 · 0 评论 -
python 装饰器
装饰器是设计模式的一种,在面向对象中可以实现动态的给对象添加功能,通常使用对象组合的方式来实现。如现在有个类A有个操作operation定义如下:class A: def operation(self): print 'sonme operation'我们需要对A的操作进行装饰,希望在operation前后做一些装饰操作,所以我们实现如下装饰类:class原创 2015-06-15 00:58:21 · 511 阅读 · 0 评论 -
Decoding CAPTCHA’s:使用PIL解验证码
转自:http://www.boyter.org/decoding-captchas/Decoding CAPTCHA’sAre you really interested in learning how to Decode CAPTCHA’s? Click this link and register your interest for my book abo转载 2015-05-13 14:33:37 · 2227 阅读 · 0 评论 -
python 过滤四字节字符 表情字符
项目中有时需要过滤掉四字节以上的字符,比如mysql数据库5.5.3以下的版本text字段不支持四字节以上字符于是就需要过滤掉再入库,python中的方法为:try: # python UCS-4 build的处理方式 highpoints = re.compile(u'[\U00010000-\U0010ffff]')except re.error:原创 2014-12-06 22:43:55 · 5326 阅读 · 0 评论 -
python ucs-2与ucs-4编码方式判断
以 --enable-unicode=ucs4 编译则:>>> import sys>>> print sys.maxunicode1114111以 --enable-unicode=ucs2 编译则:>>> import sys>>> print sys.maxunicode65535原创 2014-12-07 17:52:08 · 9149 阅读 · 0 评论 -
apache PyString_FromString: Assertion `str != ((void *)0)' failed. 错误处理
最近遇到个奇怪的问题,我将django项目迁到到另一台服务器时,原创 2014-10-08 17:16:35 · 2831 阅读 · 0 评论 -
python 使用set对列表去重,并保持列表原来顺序
# 收件人去重,并保持原来的收件人顺序mailto = []addr_to = list(set(mailto))addr_to.sort(key = mailto.index)原创 2014-07-24 15:46:17 · 29557 阅读 · 6 评论 -
Python开发者最常犯的10个错误
Python开发者最常犯的10个错误http://www.youkuaiyun.com/article/2014-05-12/2819716-Top-10-Mistakes-that-Python-Programmers-Make原创 2014-05-13 19:33:12 · 786 阅读 · 0 评论 -
python 剪贴板与文件复制操作
#coding:utf-8import shutilimport timeimport tracebackimport jsonimport urllibimport reimport osimport sysimport loggingimport datetimeimport win32clipboard as w import win原创 2013-10-14 11:07:33 · 5298 阅读 · 0 评论 -
python脚本放到linux的cgi-bin下出现Premature end of script headers问题
在本地编写了一个py接口文件,放到本地apache的cgi-bin目录下,访问接口没有问题可是当传到linux服务器上的apche的cgi-bin目录时,却报(2)No such file or directory: exec of '/usr/local/apache_2.0.63/cgi-bin/tmgr/ReportCommon.py' failed[Thu Sep 05 10:58原创 2013-09-06 10:18:25 · 3002 阅读 · 2 评论 -
python logging.basicConfig不生效的原因
最近在写脚本时,明明在脚本里使用logging.basicConfig配置了log目录,可目录文件确实空的 import logging from Logger import logger as log # log.Log_Info('nihaohaohao') # 设置log的存储文件 logging.basicConfig(filename = os.path.join(o原创 2013-08-02 10:36:07 · 8078 阅读 · 3 评论 -
Python通过文件头来判断文件的真实类型
### # 文章:Python通过文件头来判断文件类型 # 作者:http://aminby.net ### import struct # 支持文件类型 # 用16进制字符串的目的是可以知道文件头是多少字节 # 各种文件头的长度不一样,少半2字符,长则8字符 def typeList(): return {转载 2013-07-15 16:03:52 · 10925 阅读 · 2 评论 -
wxPython Dialog点两次关闭才关了的原因
Frame里调用一个模态框Dialog,可是发现点关闭按钮时,对话框没有关闭而是闪了一下当再次点击关闭才关了对话框后来发现原来是在Frame的事件处理最后调用了event.Skip()的原因event.Skip()是建表单时框架自动加的查看event.Skip()的作用:event.skip()的作用是告诉MainLoop继续处理这个消息,而不是在当前han原创 2013-07-11 20:29:05 · 1739 阅读 · 1 评论