标签:pos form val format 格式化 pytho orm style 格式化输出
name = ‘jack‘ age = 18 sex = ‘man‘ job = "IT" salary = 9999.99 print(f‘my name is {name.capitalize()}.‘) print(f‘I am {age:*^10} years old.‘) print(f‘I am a {sex}‘) print(f‘My salary is {salary:10.3f}‘) # 结果 my name is Jack. I am ****18**** years old. I am a man My salary is 9999.990
print(f‘XXXX‘)要使用python3.6及以上,否则会报错invalid syntax.
标签:pos form val format 格式化 pytho orm style 格式化输出
原文地址:https://www.cnblogs.com/dulun/p/11632140.html