
python
bigsnowstorm
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
String Formatting Operator
http://www.tutorialspoint.com/python/python_strings.htm One of Python's coolest features is the string format operator %. This operator is unique to strings and makes up for the pack of having fu转载 2013-06-09 23:21:40 · 648 阅读 · 0 评论 -
python help获取帮助
http://woodpecker.org.cn/abyteofpython_cn/chinese/ch03s06.html 1. 如果你需要某个Python函数或语句的快速信息帮助,那么你可以使用内建的help功能。尤其在你使用带提示符的命令行的时候,它十分有用。比如,运行help(str)——这会显示str类的帮助。str类用于保存你的程序使用的各种文本(字符串)。类将原创 2013-06-09 22:41:09 · 2931 阅读 · 0 评论 -
telnetlib
The telnetlib module provides a Telnet class that implements the Telnet protocol. 也就是说,可以通过该模块连接telnet server。 官方文档给出了该模块的一个典型应用,如下: import getpass import sys import telnetlib HOST = "localh原创 2013-10-13 01:34:27 · 1660 阅读 · 0 评论 -
urllib2: Basic Authentication
http://www.voidspace.org.uk/python/articles/authentication.shtml#base64 首先可以用如下代码判断是否可以读取该网页的url: import urllib #print urllib.urlopen('http://www.google.com').read() theurl = urllib.urlopen('http转载 2013-09-24 07:46:58 · 1931 阅读 · 0 评论 -
iterator, __iter__, __next__
一、 As simply as I can put it: __iter__ defines a method on a class which will return an iterator (an object that successively yields the next item contained by your object). The iterator ob转载 2013-07-06 06:56:55 · 1083 阅读 · 0 评论 -
Generator
http://wiki.python.org/moin/Generators 一、 Generators functions allow you to declare a function that behaves like an iterator, i.e. it can be used in a for loop. Simplified Code T转载 2013-07-06 08:53:03 · 562 阅读 · 0 评论 -
Built-in Functins
一、isinstance http://blog.youkuaiyun.com/kiki113/article/details/4152964 Python可以得到一个对象的类型 ,利用type函数: >>>lst = [1, 2, 3] >>>type(lst) 不仅如此,还可以利用isinstance函数,来判断一个对象是否是一个已知的类型。 isinstance说明如下转载 2013-07-02 07:32:40 · 557 阅读 · 0 评论 -
__call__
一、 http://hi.baidu.com/feng2211/item/d55d0415602bfcfcdceeca45 Python中有一个有趣的语法,只要定义类型的时候,实现__call__函数,这个类型就成为可调用的。 换句话说,我们可以把这个类型的对象当作函数来使用,相当于 重载了括号运算符。 下面定义这样一个类型: class g_dpm(object): def __in转载 2013-07-02 06:16:53 · 541 阅读 · 0 评论 -
os模块
1.os.getenv() os.getenv = getenv(key, default=None) Get an environment variable, return None if it doesn't exist. The optional second argument can specify an alternate default. 2.os.ge转载 2013-06-13 21:54:23 · 535 阅读 · 0 评论 -
platform模块
1. platform.platform(aliased=0, terse=0) Returns a single string identifying the underlying platform with as much useful information as possible. The output is intended to be human readable rathe转载 2013-06-13 23:19:19 · 561 阅读 · 0 评论 -
getpass模块
http://docs.python.org/2/library/getpass.html The getpass module provides two functions: getpass.getpass([prompt[, stream]]) Prompt the user for a password without echoing. The user is p转载 2013-06-13 22:03:51 · 668 阅读 · 0 评论 -
pickle模块
http://www.cnblogs.com/hanmeimei/archive/2011/07/23/python5.html Python提供一个标准的模块,称为pickle。使用它你可以在一个文件中储存任何Python对象,之后你又可以把它完整无缺地取出来。这被称为 持久地 储存对象。 还有另一个模块称为cPickle,它的功能和pickle模块完全相同,只不过它是用C语言编写的转载 2013-06-10 00:57:00 · 617 阅读 · 0 评论 -
sys.agrv
http://stackoverflow.com/questions/2626026/python-sys-argv-lists-and-indexes 1. C:\> hello.py John argv represents all the items that come along via the command-line input, but counting start原创 2013-06-10 00:34:57 · 704 阅读 · 0 评论 -
pass, EOFError
http://docs.python.org/release/2.5.2/ref/pass.html pass is a null operation -- when it is executed, nothing happens. It is useful as a placeholder when a statement is required syntactically, but转载 2013-06-10 07:17:03 · 759 阅读 · 0 评论 -
file函数
file(name[, mode[, buffering]]) Constructor function for the file type, described further in section File Objects. The constructor’s arguments are the same as those of the open() built-in funct转载 2013-06-10 00:46:18 · 820 阅读 · 0 评论