美文网首页
笨方法学python 习题15

笨方法学python 习题15

作者: d1b0f55d8efb | 来源:发表于2017-07-07 15:22 被阅读0次
from sys import argv
script, filename = argv
txt = open(filename)

print ("Here's your file %r:" % filename)
print (txt.read())
print ("Type the filename again:")

file_again = input("> ")
txt_again = open(file_again)

print (txt_again.read())
open(filename)就是打开文件命令   filename填写文件路径(路径中不要出现中文)
print (txt.read()) 打印读取的内容
WX20170707-152203@2x.png

相关文章

网友评论

      本文标题:笨方法学python 习题15

      本文链接:https://www.haomeiwen.com/subject/ibalhxtx.html