如何用python读取文本中指定行的内容

如题所述

可以用遍历关键字查找的方式,

for i in text.readlines():
    if a in i :
        print i
温馨提示:答案为网友推荐,仅供参考