随笔分类 -  python

摘要:网上查找原因说:出现该错误的原因是因为版本不兼容。检查了一下python版本和oracle 的版本,我的oracle client是10g的,python的版本是2.7,但我安装的cx_oracle是cx_Oracle-5.0.2-11g.win32-py2.5.msi, 是for 11g的.于是换了一个cx_Oracle-5.0.2-10g.win32-py2.5.msi。这回还是报错,不过换了一个错误,说是哪个DDL找不到。解决办法:还是下载 10g,python 2.7 的,这回编译的时候总算没什么问题了。看了python的版本一致性要求还是挺高的啊。 阅读全文
posted @ 2013-11-13 17:31 Alex-Zeng 阅读(2137) 评论(0) 推荐(0)
摘要:因工作需要,要查找中文汉字分词,因为python正则表达式\W+表示的是所有的中文字就连标点符号都包括。所以要想办法过滤掉。参考博客:http://log.medcl.net/item/2011/03/the-chinese-deal-is-the-python/1.匹配中文时,正则表达式规则和目标字串的编码格式必须相同 print sys.getdefaultencoding() text =u"#who#helloworld#a中文x#" print isinstance(text,unicode) print textUnicodeDecodeError: ' 阅读全文
posted @ 2013-10-24 14:54 Alex-Zeng 阅读(661) 评论(0) 推荐(0)
摘要:安装参考博客:http://davenzhang.com/scrapy_install.htm我是先安装了scrapy,发现import scrapy 的时候报错。之后一次安装了下面关联软件的.exe文件。之后就可以导入了。Twisted:twisted-Downloadzope.interface:zope.interface-Downloadlxml:lxml-DownloadpyOpenSSL:pyopenssl-Download这时候 import scrapy 的时候很正常,但是用scrapy startproject demo 的时候报错了,看version 也报错D:\Just4 阅读全文
posted @ 2013-09-06 11:54 Alex-Zeng 阅读(1129) 评论(0) 推荐(0)
摘要:#-*- coding:utf-8 -*-##D.has_key(k): A predicate that returns True if D has a key k.##D.items(): Returns the contents of dictionary D as a list of two-element tuples(k,v),##D.iteritems():Returns an iterator that generates the values from dictionary D as##a sequence of two-element tuples(k,v).##signa 阅读全文
posted @ 2013-08-22 10:44 Alex-Zeng 阅读(348) 评论(0) 推荐(0)
摘要:# -*- coding:utf-8 -*-##s.partition(d)##Searches string s for the first occurrence of some delimiter string d.if s contains##the delimiter,it returns a truple(pre,d,post),where pre is the part of s before##the delimiter ,d is the delimiter itself,and post is the part of s after the delimiter.##s=u&# 阅读全文
posted @ 2013-08-20 18:05 Alex-Zeng 阅读(290) 评论(0) 推荐(0)
摘要:--Notes:测试环境:Windows ,python 2.7.3,python 自带的IDLE#-*- coding: utf-8 -*-# First Lesson# --- Line syntax ---# The comment character is "#" ;comments are terminated by end of line.# Long lines may be continued by ending the line with a backslash(\).# --- Names and Keywords ---# Python names(a 阅读全文
posted @ 2013-08-15 08:53 Alex-Zeng 阅读(257) 评论(0) 推荐(0)
摘要:MyEclipse上安装pythonIDE 参考:http://hi.baidu.com/ma7226087/item/a6d87ffa65de9110d6ff8c65只是文章中提到的pyDev的地址现在不能用了,可以用http://pydev.org/updates这个地址。文章写的很好,讲到了pyDev的一些常见操作。导入cx_Oracle 的时候报:ImportError: DLL load failed with error code 193These two errors are the same error, code 193, reported two different way 阅读全文
posted @ 2013-02-26 19:06 Alex-Zeng 阅读(427) 评论(0) 推荐(0)
摘要:1.字面意义上的常量一个字面意义上的常量的例子是如同5、1.23、9.25e-3这样的数,或者如同'This is a string'、"It's a string!"这样的字符串,数2总是代表它自己,而不会是别的什么东西——它是一个常量,因为不能改变它的值。2.数python中有4中类型的数--整数、长整数、浮点数和复数。长整数不过是大一些的整数,3.14和96.8E-4是浮点数的例子。3.字符串a.使用单引号('),可以用单引号知识字符串,’Quote me on this',所有的空格制表符都照原样保留。b.使用双引号(&quo 阅读全文
posted @ 2013-02-02 23:26 Alex-Zeng 阅读(212) 评论(0) 推荐(0)
摘要:简明python教程,http://woodpecker.org.cn/abyteofpython_cn/chinese/ 阅读全文
posted @ 2012-09-16 18:21 Alex-Zeng 阅读(136) 评论(0) 推荐(0)