一.如何去接收用户的输入?使用函数 input() 函数 input() 让程序暂停运行,等待用户输入一些文本,获取用户的输入后,Python将其存储到一个变量中,以方便后期使用. name = input("Tell me your name,and I will repeat it back to you:") print(name) console: , 函数 input() 接收一个参数,就是要想用户展示的提示或说明,让用户知道该如何做.用户输入后按下enter 键,将执行下一…
最近在自学python,简单的总结了一下文件的输入的方式. 1. f=open("foo.txt") line=f.readline() while line: print(line,end='') line=f.readline() f.close() 2. for line in open("foo.txt"): print(line,end='') 3. f=open("foo.txt") lines=f.readlines() for l…