0

Is it possible to split an input of two integers separated by a space such as '1 2' to be split into two separate variables? I have tried

ratio = input()
a,b = ratio.split(' ')

but it returns an error message of 'SyntaxError: unexpected EOF while parsing'.

T. Green
  • 323
  • 10
  • 20

1 Answers1

3

Try using raw_input() instead of input()

raw_input strips trailing newline. https://docs.python.org/2/library/functions.html#raw_input

Oluwafemi Sule
  • 36,144
  • 1
  • 56
  • 81
Maikel
  • 300
  • 2
  • 11