#35885: Python 正確讀到 stdin (standard input) EOF(end of file)


900131shawn@gmail.com (nocmos_0623)

學校 : 不指定學校
編號 : 124194
來源 : [49.217.6.48]
最後登入時間 :
2023-06-24 16:31:19
d010. 盈數、虧數和完全數 -- Sagit's C++ 程式設計 | From: [115.165.216.180] | 發表日期 : 2023-06-21 21:45

from sys import stdin

for line in stdin:
  print(line, end='')

 

不要再用 While True 搭配 try  except 查一下網路很難嗎
https://stackoverflow.com/questions/21235855/how-to-read-user-input-until-eof

 
ZeroJudge Forum