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
View Code
* Get absolute path of script: os.path.split(os.path.realpath(__file__))[0]
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]
相关文章推荐
- iptables NAT地址池中的地址选取
- flume单channel多sink的测试
- Java UDP
- 利用DirectSound实现声卡录音
- NGUI:UICamera
- NGUI:UIPanel
- 给APP增加RSA签名
- leetcode面试准备: Maximal Rectangle
- C++中创建、初始化以及删除 以变量为大小的动态二维数组
- 第四周项目一建立单链表
- 关于升级Xcode7后真机测试项目遇到的问题总结
- ARC下的block的循环引用问题
- head 命令
- 三——第二部分——第二篇论文 计划建设SQL Server镜像
- Linux shell学习笔录
- iOS 根据文字字数动态确定Label宽高
- Erlang EPMD
- Erlang EPMD
- KDE 桌面环境已迎来 19 岁生日
- c++primer——面向对象编程关键字