您的位置:首页 > 其它

Standard Library Modules Using Notes

2015-10-15 17:30 316 查看
类型转换

int(x [,base ]) 整数 long(x [,base ]) 长整数 float(x ) 浮点数 complex(real [,imag ]) 复数 str(x ) 字符串 repr(x ) 表达式字符串
eval(str ) 用来计算在字符串中的有效Python表达式,并返回一个对象
tuple(s ) 元组 list(s ) 列表 chr(x ) 字符 unichr(x ) Unicode字符 ord(x )字符转换为它的整数值
hex(x ) 整数转换为一个十六进制字符串 oct(x ) 整数转换为一个八进制字符串

_winreg

REG_NONE 0 REG_SZ 1 REG_EXPAND_SZ 2 REG_BINARY 3 REG_DWORD 4 REG_DWORD_LITTLE_ENDIAN 4 REG_DWORD_BIG_ENDIAN 5 REG_LINK 6 REG_MULTI_SZ 7
REG_RESOURCE_LIST 8 REG_FULL_RESOURCE_DESCRIPTOR 9 REG_RESOURCE_REQUIREMENTS_LIST 10 REG_QWORD 11 REG_QWORD_LITTLE_ENDIAN 12

CloseKey() – 关闭一个Key
ConnectRegistry() – 链接到其他机器的注册表
CreateKey() – 创建一个Key
DeleteKey() – 删除一个Key
DeleteValue() – 删除一个Key里面的值(value)
EnumKey() – 为已经打开的Key里面的子键建立索引
EnumValue() – 为打开的键中的值建立索引
FlushKey() – 回写所有的键属性改变到注册表
LoadKey() – 从指定文件读入键信息
OpenKey() – 打开一个键
OpenKeyEx()
QueryValue() – 在注册表中检索一个键的路径
QueryValueEx() – 注册表中检索一个键的路径
QueryInfoKey() – 返回关于键的信息
SaveKey() – 保存键到文件
SetValue() – 设置一个键
SetValueEx() – 设置一个值


# The content of file F:\test\test.py as follows:
import sys
print sys.argv
print sys.path[0]

# Run it in different path
C:\ > python F:\test\test.py
['F:\test\test.py']
['F:\test\test.py']

F:\ > python test\test.py
['test\test.py']
['F:\test\test.py']

# So, argv[0] is the same as the first arg of command totally, on matter relative or absolute path
# but path[0] will fill the relative path to absolute one


View Code
* Get absolute path of script: os.path.split(os.path.realpath(__file__))[0]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: