【发布时间】:2020-03-23 16:25:49
【问题描述】:
该函数在 tempconv.py 文件中定义为
def fahr2cels(fahr) :
cels = 5/9 * (fahr - 32)
return cels
还有一个名为 tempmax_cels.txt 的文本文件 这是一行数字。 我想在像
这样的 bash shell 中编写命令行python tempconv.py < tempmax_cels.txt
因此计算机可以接受文本文件作为标准输入。 我该如何纠正 tempconv.py 来做到这一点? (使用导入系统模块)
【问题讨论】: