43

Python学习20:利用函数来打印文件内容-St3ph3N的博客

 6 years ago
source link: http://blog.51cto.com/6150141/2072958
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
#--coding:utf-8--#从sys模块导入argv函数fromsysimportargv#利用argv函数,把argv中的东西解包,将所有的参数依次赋予左边的变量名script,input_file=argv#自定义一个函数,读取f的内容defprint_all(f):printf.read()#自定义函数,使用file中的seek方法来移动文件游标,用于依次读取文件行的功能defrew

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK