手机网站底部电话,淮安网站建设多少钱,公司网站域名解析谁来做,北仑做网站Python3实现从txt文件中读取指定行的方法 本文实例讲述了Python3实现从文件中读取指定行的方法。分享给大家供大家参考。具体实现方法如下#xff1a;def getline(the_file_path, line_number):if line_number 1:return for cur_line_number, line in enumerate(open(the… Python3实现从txt文件中读取指定行的方法 本文实例讲述了Python3实现从文件中读取指定行的方法。分享给大家供大家参考。具体实现方法如下 def getline(the_file_path, line_number):if line_number 1:return for cur_line_number, line in enumerate(open(the_file_path, rU)):if cur_line_number line_number-1:return linereturn the_line linecache.getline(d:/FreakOut.cpp, 222)
print (the_line)