如何解决python中列表不可调用的问题?

2024-09-28 01:28:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我是python新手,遇到了这个List is not callable错误。 我应该怎么做来防止这种情况发生?谢谢

def PrintTxt(src, beg, end):
    with open(src, 'r') as f1:
        srctxt = f1.readlines()
        for line in srctxt(beg, end):
            print(line)

Filepath = 'C:\test.txt'

PrintTxt(Filepath,1,5)

Tags: srcis错误linenot情况listend

热门问题