我正在制作一个脚本,它从终端接收一个文件作为输入。为了做到这一点,我这样称呼myScript:脚本也非常简单:for line in fileinput.inputif 'BLABLABLA' in line:
print(line, 'THAT IS THE LINE CONTAINING BLABLABLA from the file %s'
我得到了以下错误:当TypeError: input() got an unexpected keyword argument 'encoding'试图使用fileinput.input()从python中的stdin读取时,文档说文件输入应该这样使用。我在用python 3.9for line in fileinput.input(encoding="utf-8"):
process(