4

I have code wrote on Windows, compiles and works correctly, but fails on the raspberry pi

wrote some simple test code to see if it spits out the same error

a = input('this is a test string to split at space \n').split()

print(a)

typed 15:00 (need this data point for the bigger project) and i got this error

15:00
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    a = input('this is a test string to split at : \n').split(':')
   File "<string>", line 1
    15:00
      ^
 SyntaxError: invalid syntax

then tried 15 00 at the request of someone on discord, got this message

15 00
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    a = input('this is a test string to split at : \n').split(':')
  File "<string>", line 1
    15 00
        ^
SyntaxError: unexpected EOF while parsing
0

1 Answer 1

1

You may be running different versions of python from windows to Raspberry Pi.

Thanks to this answer:

Note: this is only for Python 2. For Python 3, raw_input() has become plain input() and the Python 2 input() has been removed.

Reference

a = raw_input('this is a test string to split at space \n').split(':')

print(a)

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.