无法使它正常运行python错误

时间:2018-10-09 04:06:59

标签: python parsing

while True:
  inputstring = input("Enter input string: ") 
  "\n"

  if (inputstring == 'q'):
    break
  if ',' not in inputstring:
    print("\nError: No comma in string.")
  else:
    fname , sname = inputstring.split(',')

    fname , sname = fname.strip(), sname.strip()

    print("\nFirst word:", fname)

    print("Second word:", sname)

    print("\n")



Enter input string: Traceback (most recent call last):
  File "main.py", line 2, in <module>
    inputstring = input("Enter input string: ") 
EOFError: EOF when reading a line

1 个答案:

答案 0 :(得分:0)

将第3行更改为'print(“ \ n”)'