We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1:加号
n = 20 s = s1 + str(n) print(s) v = 12.44 b = True print(s1 + str(n) + str(v) + str(b))
hello20 hello2012.44True
2: 格式化
s = '<%s> <%d> <%.2f>' %(s1,n,v) print('格式化:',s)
格式化: <hello> <20> <12.44>
<hello> <20> <12.44>
3:重定向
from io import StringIO import sys old_stdout = sys.stdout result = StringIO() sys.stdout = result print(s1, True, n,v,sep='*') #设置分隔符为 * sys.stdout =old_stdout # 恢复标准输出 result_str = result.getvalue() print("用逗号连接:",result_str)
用逗号连接: hello*True*20*12.44
hello*True*20*12.44
The text was updated successfully, but these errors were encountered:
#5
Sorry, something went wrong.
No branches or pull requests
1:加号
2: 格式化
3:重定向
The text was updated successfully, but these errors were encountered: