python
文章平均质量分 57
我想我可以更强
vgsdgfd
展开
-
python mongo数据库出错解决及pymongo操作
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/原创 2014-01-05 19:21:53 · 3270 阅读 · 0 评论 -
python with
import sysclass test: def __enter__(self): print "enter" return 1 def __exit__(self,*args): print "exit" return Truewith test() as t: print "t is not the result of test().it is __enter__ returned" pri原创 2017-02-03 17:25:01 · 281 阅读 · 0 评论 -
python range 范围问题
http://www.cnblogs.com/buro79xxd/archive/2011/05/23/2054493.html详细记录python的range()函数用法使用python的人都知道range()函数很方便,今天再用到他的时候发现了很多以前看到过但是忘记的细节。这里记录一下range(),复习下list的slide,最后分析一个好玩儿的冒泡程序。转载 2017-01-31 23:35:33 · 28019 阅读 · 0 评论 -
pip3 下载超时
pip3 read time out errorup vote2down votefavoritesudo pip3 install scikit-learn (any module really just using most recent attempt)sudo pip3 install -U s原创 2017-01-30 23:48:21 · 4369 阅读 · 0 评论 -
python编辑器
pycharm原创 2017-01-30 20:10:04 · 373 阅读 · 0 评论 -
matplot 安装
InstallingThere are many different ways to install matplotlib, and the best way depends on what operating system you are using, what you already have installed, and how you want to use it. To avoi原创 2017-01-30 16:45:26 · 1234 阅读 · 0 评论 -
print list 无法显示中文
down votewhy did the last line get the correct output, and the others didn't?When you print foo, what gets printed out is str(foo).However, if foo is a list, str(foo) uses re原创 2017-01-24 20:26:43 · 496 阅读 · 0 评论 -
numpy中的nonzero()的用法
nonzero(a)返回数组a中值不为零的元素的下标,它的返回值是一个长度为a.ndim(数组a的轴数)的元组,元组的每个元素都是一个整数数组,其值为非零元素的下标在对应轴上的值。例如对于一维布尔数组b1,nonzero(b1)所得到的是一个长度为1的元组,它表示b1[0]和b1[2]的值不为0(False)。[python] view plain copy转载 2017-02-12 20:37:47 · 1241 阅读 · 0 评论 -
ubuntu16.04中将python3设置为默认
直接执行这两个命令即可:sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150 如果要切换到Python2,执行:原创 2017-01-30 16:01:03 · 3220 阅读 · 2 评论 -
文件乱码显示处理办法 ubuntu
解决方法:一. Ubuntu默认的中文字符编码Ubuntu默认的中文字符编码为zh_CN.UTF-8,这个可以在/etc/environment中看到:sudo gedit /etc/environment可以看到如下内容:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/game原创 2017-02-20 01:17:12 · 1193 阅读 · 0 评论 -
十分钟搞定pandas
十分钟搞定pandas本文是对pandas官方网站上《10 Minutes to pandas》的一个简单的翻译,原文在这里。这篇文章是对pandas的一个简单的介绍,详细的介绍请参考:Cookbook 。习惯上,我们会按下面格式引入所需要的包:一、 创建对象可以通过 Data Structure Intro Setion 来查看有关该节内容的详细信息转载 2017-02-18 01:40:58 · 663 阅读 · 1 评论 -
CVE文档解析
#-*- coding:utf-8 -*-from xml.etree import ElementTreeimport xml.etree.ElementTree as xmltree = xml.parse('allitems-cvrf-year-1999.xml')for elems in tree.iter("{http://www.icasi.org/CVRF/schema/原创 2014-01-05 16:20:37 · 1034 阅读 · 0 评论 -
beautiful soul 解析html
用BeautifulSoup 解析html和xml字符串 对象参数说明 实例: #!/usr/bin/python # -*- coding: UTF-8 -*- from bs4 import BeautifulSoup import re #待分析字符串 html_doc = """转载 2017-02-24 15:37:44 · 823 阅读 · 0 评论