「< 文件」把文件内容接到程序的标准输入
程序照常读输入,读到文件末尾就结束
在终端里用 python3 stat.py < in.txt 运行,程序里读 sys.stdin 读到的是【0】。
python3 stat.py < in.txt
sys.stdin
全部评论