目录: 1.集合set 2.计数器 3.有序字典 4.默认字典 5.可命名元组 6.队列 7.深浅拷贝 8.函数 9.lambda表达式 10.内置函数 一.集合set set是一个无序且不重复的元素集合 class set(object): """ set() -> new empty set object set(iterable) -> new set object Build an unordered collection of unique elemen…
fileinput模块可以对一个或多个文件中的内容进行迭代.遍历等操作.该模块的input()函数有点类似文件readlines()方法,区别在于前者是一个迭代对象,需要用for循环迭代,后者是一次性读取所有行. 用fileinput对文件进行循环遍历,格式化输出,查找.替换等操作,非常方便. import fileinput for line in fileinput.input(): process(line) [基本格式] fileinput.input([files[, i…
在Python中执行系统命令有os.system().os.popen().commands.getstatusoutput().subprocess.Popen等 1.os.system() Python中关于os.system的描述: >>> import os >>> help(os.system) system(command) -> exit_status Execute the command (a string) in a subshell.…
if/else for while 函数的使用 JavaScript语句 if/else 语句 JavaScript 中的if/else 判断选择,语法格式是这样的 switch/case 语句 在做大量判断的时候,如果依然使用if/else 结构,那么代码有可能会变得很凌乱,于是我们采用了switch/case结构 for 循环 for循环的格式 while 循环 do while 循环 break 和continue 语句 break 本语句放在循环体内,作用是立即跳出循环 continue…