随笔分类 - Python
摘要:1. 用word_tokenize的时候说 u'tokenizers/punkt/english.pickle' not found. 我nltk.download(),想把所有的corpus下下来,但经常断。于是手动在网站上把corpora下下来,但还是说不对。 其实只要nltk.download
阅读全文
摘要:在用http://muricoca.github.io/crab/tutorial.html 里给的例子时,会发现不能运行,改库里的两个小地方就好了。 1. no module named learn: 把scikit.base里的from scikit.learn.base改成from sklea
阅读全文
摘要:python文本分析用到scikit-learn包,用pip安装:pip install -U scikit-learn
阅读全文
摘要:把.csv文件导入mysql,.csv文件以','分隔,在每一项字符串中含有',' 不能用load data local infile .. fields terminated by ',',否则字符串被截断。 用re
阅读全文
摘要:之前装过beautifulsoup,这次要装lxml,用easy_install装:到python/scripts目录下,运行easy_install lxml,自动安装 分界线 之前直接用urlopen(url),拒绝访问,403forbidden 模仿真实上网,添加cookie (转自http:
阅读全文
摘要:import mysql.connector 在命令行里运行python脚本,显示没有mysql.connector cnx = mysql.connector(user =' ', password=' ',host =' ', database =' ') cnx.close() cursor
阅读全文
摘要:1. python读取文件时的路径,明明是放在一个文件夹里,怎么不完整路径会错 2. file.write(str1+str2)用+拼接,不能用, 3. open()用法: 4. 在用r+模式读写文件时,写之前要file.seek(文件位置),不然无法写。
阅读全文
摘要:random.sample(sequence, k),从指定序列中随机获取指定长度的片断。sample函数不会修改原有序列 numpy.nonzero() Return the indices of the elements that are non-zero.
阅读全文

浙公网安备 33010602011771号