1 string formatting
1 #!/urs/bin/env python2 3Name = input ("Name:")4age = Int (input ("Age :"))5Job = input ("Job:")6Salary = input ("Salary:")7 8Info1 ="""9 Ten -----------Info1 of%s--------- One Name:%s A Age :%s - Job:%s - Salary:%s the """%(name, name, age, job, salary) - - Print(INFO1) - +Info2 =""" - + -----------Info2 of {_name}---- A Name: {_name} at Age : {_age} - Job: {_job} - Salary: {_salary} - """. Format (_name=name, -_age=Age , -_job=Job, in_salary=salary) - to Print(Info2) + -Info3 =""" the * ------Info3 of {0}------- $ Name: {0}Panax Notoginseng Age : {1} - Job: {2} the Salary: {3} + """. Format (name, age, job, salary) A the Print(INFO3)View Code
2 Password non-clear display
1 #!/urs/bin/env python2 #-*-coding:utf-8-*-3 4 ImportGetpass5Username = input ("Username:")6Password = Getpass.getpass ("Password:")7 8 Print(username)9 Print(password)View Code
Note in Pycharm, run in command-line mode: Python xxx.py can
Python Basics Day01 Exercises