随笔分类 -  Python

摘要:csf@ubuntu:~$ sudo apt install python-scrapy 阅读全文
posted @ 2017-07-30 14:13 cdsj 阅读(125) 评论(0) 推荐(0)
摘要:http://it.010lm.com/os/LINUX/182036.html ipython[notebook]安装(Linux平台) 1. 环境 操作系统:ubuntukylin 2. 操作步骤 a) 安装pip工具 终端输入以下命令: b) 安装ipython 终端输入以下命令: there 阅读全文
posted @ 2016-05-04 11:44 cdsj 阅读(253) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/ll_0520/article/details/6077913 阅读全文
posted @ 2016-03-27 10:26 cdsj 阅读(118) 评论(0) 推荐(0)
摘要:http://my.oschina.net/u/1156660/blog/369667 转自:http://blog.csdn.net/werm520/article/details/7617376 切片操作符是序列名后跟一个方括号,方括号中有一对可选的数字,并用冒号分割。注意这与你使用的索引操作符 阅读全文
posted @ 2016-02-01 21:03 cdsj 阅读(237) 评论(0) 推荐(0)
摘要:http://docs.scipy.org/doc/numpy/reference/generated/numpy.mean.html numpy.mean(a, axis=None, dtype=None, out=None, keepdims=False)[source] Compute the 阅读全文
posted @ 2016-02-01 20:39 cdsj 阅读(400) 评论(0) 推荐(0)
摘要:ctrl-.是批量注视 ctrl->向前缩进 ctrl-<向后缩进 阅读全文
posted @ 2016-02-01 19:55 cdsj 阅读(271) 评论(0) 推荐(0)
摘要:1.下载jdk-7u75-linux-x64.tar.gz,默认在/home/csf/Downloads2.csf@ubuntu:~/Downloads$ sudo mkdir /usr/java3.csf@ubuntu:~/Downloads$sudo tar zxvf jdk-7u75-linu... 阅读全文
posted @ 2015-02-14 13:05 cdsj 阅读(225) 评论(0) 推荐(0)
摘要:1.hadoop安装好之后,执行ssh localhost无法执行, 提示“ssh: connect to host localhost port 22: Connection refused”。2.ps -e |grep ssh查看后只有 “3748 ? 00:00:00 ssh-age... 阅读全文
posted @ 2015-02-13 15:30 cdsj 阅读(4110) 评论(0) 推荐(0)
摘要:转自:http://zhidao.baidu.com/link?url=DCRUPZtmAyLDHno812YTk42-ahhFyrejkR98UIJzpPq3zYGoGJc6gNPxtq2SnWJPcHcW5Eatg4is9n2ol3DG5I9lueWMx1S_tMtlaeFF7G3def sol... 阅读全文
posted @ 2014-12-10 23:49 cdsj 阅读(171) 评论(0) 推荐(0)
摘要:1.下载python2.7,安装。比如安装到c:\python27\2.设置环境变量,path,加入c:\python27\;c:\python27\scripts\3.下载setuptools,解压。4.运行cmd,进入setuptools目录,执行python ez_setup。5.script... 阅读全文
posted @ 2014-11-24 13:38 cdsj 阅读(145) 评论(0) 推荐(0)
摘要:http://docs.python-guide.org/en/latest/scenarios/scrape/ 阅读全文
posted @ 2014-11-15 19:35 cdsj 阅读(207) 评论(0) 推荐(0)
摘要:前提是先安装python2.7,设置环境变量。1.pip install pyzmq2.pip install jinja23.pip install tornado4.pip install ipython最后运行ipython notebook 阅读全文
posted @ 2014-11-04 13:29 cdsj 阅读(241) 评论(0) 推荐(0)
摘要:ipython nbconvert notebookname.ipynb --to latex --post pdf 阅读全文
posted @ 2014-09-12 10:53 cdsj 阅读(825) 评论(0) 推荐(0)
摘要:转自:http://bbs.chinaunix.net/thread-1689276-1-1.htmlfilter(str.isdigit, '123ab45') 阅读全文
posted @ 2014-08-03 13:32 cdsj 阅读(157) 评论(0) 推荐(0)
摘要:打开https://pip.pypa.io/en/latest/installing.html#python-os-support下载pip-get.py进入python,执行pip-get.py安装完pip。或者安装,setuptool工具。进入.python/scripts目录,执行setup_... 阅读全文
posted @ 2014-07-27 00:49 cdsj 阅读(385) 评论(0) 推荐(0)
摘要:http://blog.chinaunix.net/uid-26722078-id-3484197.html1.列表推导看几个例子,一切就明白了。 1 #!/usr/bin/python 2 numbers = range(10) 3 size = len(numbers) 4 evens = [] 5 i = 0 6 while i < size: 7 if i%2 == 0: 8 evens.append(i) 9 i += 110 print evens11 12 #!/usr/bin/python13 evens = [i for i in range... 阅读全文
posted @ 2014-02-17 10:42 cdsj 阅读(201) 评论(0) 推荐(0)
摘要:http://eagletff.blog.163.com/blog/static/116350928201266111125832/一般情况下,如果要对一个列表或者数组既要遍历索引又要遍历元素时,可以用enumerate比如:for index,value in enumerate(list):print index,value当然也可以for i in range(0,len(list)):print i,list[i]相比较而言,前者更简练另外一种使用情况,当要计算文件的行数的时候,可以这样写:lineNum = len(open(fileName,'r').readlin 阅读全文
posted @ 2014-02-17 10:38 cdsj 阅读(2567) 评论(0) 推荐(1)
摘要:1 >>> help(set) 2 Help on class set in module __builtin__: 3 4 class set(object) 5 | set(iterable) --> set object 6 | 7 | Build an unordered collection of unique elements.#无序、独一无二的元素 8 | 9 | Methods defined here: 10 | 11 | __and__(...) 12 | x.__and__(y) x&y 13 | 14 | ... 阅读全文
posted @ 2014-02-06 00:03 cdsj 阅读(253) 评论(0) 推荐(0)
摘要:转自:http://blog.csdn.net/business122/article/details/7536991 1 创建列表 2 sample_list = ['a',1,('a','b')] 3 4 Python 列表操作 5 sample_list = ['a','b',0,1,3] 6 7 得到列表中的某一个值 8 value_start = sample_list[0] 9 end_value = sample_list[-1] 10 11 删除列表的第一个值 12 del sample_list[ 阅读全文
posted @ 2014-02-05 23:42 cdsj 阅读(885) 评论(0) 推荐(0)
摘要:转自:http://blog.csdn.net/business122/article/details/7537014 1 一.创建字典 2 方法①: 3 >>> dict1 = {} 4 >>> dict2 = {'name': 'earth', 'port': 80} 5 >>> dict1, dict2 6 ({}, {'port': 80, 'name': 'earth'}) 7 8 方法②:从Python 2.2 版本起 9 >& 阅读全文
posted @ 2014-02-05 23:41 cdsj 阅读(594) 评论(0) 推荐(0)