标签:nic tle 内存 evel name ble 类型 空格 format
初次编辑2017年10月4日 17:19:34
引用:百度
print("*".join(["I","am","world!"])
输出为 I\*am\*world!
字符串的格式化输出:format
%s 字符串占位
%d 整型
%f 浮点型 精度要求小数点4几位 %.4f
print("hello {0}, his age is {1}".format("alex",34)) #必须从0开始
print("hello {name}, his age is {age}".format(name = "alex", age = 34)) #键值对
print("hello {name}, his age is {age}".format_map({"name" : "alex", "age" :34})) #后面跟字典
判断是否是数字
isdecimal
isdigit
is number 可判断中文大写数字、罗马数字
print("hello\tworld".expendtab())
标签:nic tle 内存 evel name ble 类型 空格 format
原文地址:http://www.cnblogs.com/sama/p/7684227.html