import urllibimport webbrowserurl ="http://www.baidu.com"content = urllib.urlopen(url).read()#print contentopen('e:/song.htm', 'w').write(content)webb...
分类:
编程语言 时间:
2015-01-26 01:14:20
阅读次数:
170
[root@kaibin~]#ipython
In[1]:importplatform
In[2]:printplatform.uname()
(‘Linux‘,‘kaibin.test1‘,‘2.6.32-431.el6.x86_64‘,‘#1SMPFriNov2203:15:09UTC2013‘,‘x86_64‘,‘x86_64‘)
In[3]:dir(platform)#查看platform支持的功能:dir(platform)
In[4]:exit()简单方法:1.编译安..
分类:
编程语言 时间:
2015-01-25 22:42:35
阅读次数:
291
1、导入模块:import osfrom os import systemimport SocketServer as SS --别名2、使用Tab键:[root@cheeron python]# cat tab.py#python startup fileimport sysimport read...
分类:
编程语言 时间:
2015-01-25 22:31:09
阅读次数:
277
Day4: 1、class 以单下划线开头(_foo)的代表不能直接访问的类属性,需通过类提供的接口进行访问,不能用“from xxx import *”而导入;以双下划线开头的(__foo)代表类的私有成 员;以双下划线开头和结尾的(__foo__)代表python里特殊方法专用...
分类:
编程语言 时间:
2015-01-25 20:51:14
阅读次数:
211
Day1:输入输出语句:input、print控制语句:if、else、elif…循环语句:for(类似于C#里面的foreach),while…type(), isinstance()…data type:int, float, bool, str…`operator:**, //,…列表:一个打...
分类:
编程语言 时间:
2015-01-25 11:06:54
阅读次数:
219
元组:(用())和列表的不同:1、 列表更加灵活,可以任意的添加删除元素,元组一旦被创建就不可更改;>>> dir(test)['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format_...
分类:
编程语言 时间:
2015-01-25 10:58:13
阅读次数:
187
#本文仅为个人学习过程的整理和记录,如有从他人博客、网站摘录的内容,本人会明确标明,如有涉及侵权,请联系本人,本人会在第一时间删除。 一下的资料整理来自(1)廖雪峰的Python教程http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8b....
分类:
编程语言 时间:
2015-01-25 00:08:40
阅读次数:
231
#本文仅为个人学习过程的整理和记录,如有从他人博客、网站摘录的内容,本人会明确标明,如有涉及侵权,请联系本人,本人会在第一时间删除。 参考资料网址:http://www.cnhonkerarmy.com/thread-58029-1-1.html1.性能 Py3.0运行 pystone benc.....
分类:
编程语言 时间:
2015-01-24 22:33:24
阅读次数:
238
最近学习python,记录学习的点滴。>>> import numpy as np>>> a = np.array([[1,2],[3,4]])>>> b=a.tolist()>>> b[[1, 2], [3, 4]]
分类:
编程语言 时间:
2015-01-24 00:27:16
阅读次数:
188
正则表达式
用法:
>>>import re
>>>s=r'abc'
>>>re.findall(s,'abcabc')
正则语法:
元字符: . ^ $ * + ? {} [] \ | ()
[] 用于选择匹配 [abc] 匹配 a或者b或者c
[^]用于反选,比如[^abc]不含有abc的
^用于匹配行首 r'^abc' 匹配'abcd'而不是'dabc'
$用于匹...
分类:
编程语言 时间:
2015-01-23 23:02:43
阅读次数:
188