通过本文主要向大家介绍了linecache.getline,python linecache,python getline,linecache,linecache 大文件等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
比如:
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
import linecache
print linecache.getline('2.1_open.py', 4)</div>
将返回我上一节事例代码文件2.1_open.py的第4行文字,输出结果:
f = open('/home/evergreen/桌面/test')
查看linecache中的实现(我用的是Ulipad,所以直接将光标停留在linecache处,按F6键)
</div>
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
import linecache
print linecache.getline('2.1_open.py', 4)</div>将返回我上一节事例代码文件2.1_open.py的第4行文字,输出结果:
f = open('/home/evergreen/桌面/test')
查看linecache中的实现(我用的是Ulipad,所以直接将光标停留在linecache处,按F6键)
</div>

