본문 바로가기
파이썬

파이썬 줄을 읽을 때 Python EOF 오류

by º기록 2021. 1. 17.
반응형


Executing the code....
$python3 demo.py
Hello! What is your name?Traceback (most recent call last):
  File "demo.py", line 2, in 
    name = input("Hello! What is your name?")
EOFError: EOF when reading a line

여기 내 코드가 있습니다.

import sys
name = input("Hello! What is your name?")
print("So your name is {0}? Cool!".format(name))
age = input("Now tell me how old you are.")
print("So your name is {0} and you're {1} years old?".format(name, age))
yn = input("Y/N?")
if yn == "y":
    print("Okay good!")
elif yn == "n":
    sys.exit(0)

도움이 필요하세요?

 

해결 방법

 

문제가 무엇인지 모르겠지만 raw_input 사용을 고려할 수 있습니까?


사용자의 일반적인 입력에는 raw_input () 함수를 사용하는 것이 좋습니다.

 

참조 페이지 https://stackoverflow.com/questions/16279564

 

 

반응형

댓글