1. 输出字符串和数字

>>>print("facesoho") # 输出字符串facesoho>>> print(100) # 输出数字100>>> str = 'facesoho'>>> print(str) # 输出变量facesoho>>> L = [1,2,'a'] # 列表 >>> print(L)[1, 2, 'a']>>> t = (1,2,'a') # 元组>>> print(t)(1, 2, 'a')>>> d = {'a':1, 'b':2} # 字典>>> print(d){'a': 1, 'b': 2}

2. 格式化输出整数

支持参数格式化 与 C 语言的 printf 类似

>>>str = "the length of (%s) is %d" %('facesoho',len('facesoho'))>>> print(str)the length of (facesoho) is 6

python字符串格式化符号:

0篇笔记写笔记

尊贵的董事大人

英文标题不为空时 视为本栏投稿


需要关键字 描述 英文标题


X