a = input (). Split () Print (A)
When submitting to enter a line
'1 2 3'
traceback: file ", line 1, in & lt; module & gt; a = input (). Split () File "& lt; String & GT;", Line 1 1 2 3. ^ Syntaxerror: Invalid Syntax
The expression is taken from the example, should work. What could be a snag?
Answer 1, Authority 100%
This is not
Split – this
input drops out an exception. And why? Beltness. Documentation says what –
Input makes two things:
1) reads from stdin.
2) All that is read is executed (
, respectively, the
1 2 3 line cannot be completed due to the wrong syntax. In Py3, the behavior of
input () changed so that people are no longer confused. Use Raw_input . Or python3. You can also use the library Six so that with a sudden move to another version, your code has not broken, because in the PY3 function
Raw_input ( ) missing.
Answer 2, Authority 30%