好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

python输入和文件操作方法

这篇文章介绍python输入和文件操作方法

1、python 输入

Python3提供了一个input(),可以让用户输入字符串,并存放到一个变量里。如下所示,用户从键盘输入 1 ,以回车结束,输入的 “1”以字符串的形式存在了 a 变量中。

>>> a=input("Please input")
Please input1
>>> a
'1'
>>> 

f1 = open('haproxy.conf', 'r',encoding="utf-8")

for line in f1:

print(line)

以上就是python输入和文件操作方法的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于python输入和文件操作方法的详细内容...

  阅读:100次