#!/usr/bin/python import os def get_env_varible(key): return os.getenv(key) if __name__ == '__main__': key1 = "COMPUTERNAME" var1 = get_env_varible(key1) print "The value of %s in system enviroment is %s" %(key1, var1) 测试目的: 验证根据关键字key…
1.map(function,iterable) map是把迭代对象依次进行函数运算,并返回. 例子: map返回的十分map对象,需要list()函数转化. 2.exec()函数 执行储存在字符串或文件中的 Python 语句,相比于 eval,exec可以执行更复杂的 Python 代码. Execute the given source in the context of globals and locals. 在全局变量和局部变量上下文中执行给定的源. The source may be…
help函数是一个内置函数,用于查看函数或模块用途的详细说明 import copy print(help(copy.copy)) Help on function copy in module copy: copy(x) Shallow copy operation on arbitrary Python objects. See the module's __doc__ string for more info. None dir()函数时python的内置函数,dir()函数不带参数时,返…
分片:分片操作的实现需要提供两个索引作为边界,第一个包含在分片内,第二个不包含 number =[1,2,3,4,5,6,7,8,9,10] number [3:6] -->[4,5,6] number [0,1] -->[1] number [-3,-1] -->[8,9] number [-3,0] -->[ ] (当第一个索引比第二个晚出现在序列中,则是空序列) number [-3 :] -->如果分片所得部分包含头或者尾,则可以把索引置空 number [ :…