内置函数和format格式化函数
1.获取python中内置函数
import builtins
in_functions = dir(builtins)
print(in_functions)
2.format格式化函数
基本语法是通过 {} 和 : 来代替以前的 %
format 函数可以接受不限个参数,位置可以不按顺序
In [1]: "{} {}".format("hello", "world") # 不设置指定位置,按默认顺序
Out[1]: 'hello world'
In [2]: "{0} {1}".format("hello", "world") # 设置指定位置
Out[2]: 'hello world'
In [3]: "{1} {0} {1}".format("hello", "world") # 设置指定位置
Out[3]: 'world hello world'