条件判断经常使用if语句进行判断,表达方式为:if 条件语句: :elif:else if...用于执行第一条不满足if的判断,继续执行其它的判断.比如一个简单的if判断 Python3取消了raw_input(),使用input()接受输入,如果需要,在input()前加上限定条件int or float,默认str不用添加. score = int(input('input your score')) if num >= 80: print("excellllent!&quo
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
#!/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