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

2025-04-14 13:34:22
推荐回答(1个)
回答(1):

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

for i in text.readlines():
    if a in i :
        print i