笨方法学python 习题15

2017-07-07  本文已影响0人  d1b0f55d8efb
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
上一篇 下一篇

猜你喜欢

热点阅读