Python 格式化输出
#!/usr/bin/env python # Author: Andy Song # date: 2020/6/25 # 占位符: %s: string, %d: digit, %f: float name = input("Your Name Is: ") gender = input("Your Gender Is: ") age = int(input("Your Age Is: ")) job = input("Your Job Is: ") ID = int(input("Your ID Is: ")) msg = ‘‘‘ ------------------- Info of %s --------------------- Name: %s Gender: %s Age: %d Job: %s ID: %d ------------------- End ----------------------------- ‘‘‘ %(name, name, gender, age, job, ID) print(msg)