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.