python读取文件指定行内容

python读取文件指定行内容

import linecache
text=linecache.getline(r'C:\Users\Administrator\Desktop\SourceCodeofMongoRedis\chapter_5\generate_string.py',10)
第十行内容为# info = '''1000001 王小小'''

猜你喜欢

转载自www.cnblogs.com/tjp40922/p/12393080.html