Error with useing .split() with user input in python
<p>So I am trying to make a basic address book in python that can save contacts and load them using pickle, but for some reason I get an error when I try to put in a  contact
My code is:</p>

<pre><code>import pickle
class Contact:
    def __init__(self, firstname, lastname, phonenumber, adress):
        self.firstname = firstname
        self.lastname = lastname
        self.phonenumber = phonenumber
        self.adress = adress
print('Welcome to your adress book, would you like to:\n1. Add a contact\n2. Look at a contact\n3. Close the program')
while True:
    choice = int(input())
    if choice == 1:
        print('Type in their information, with the format\nfirstname lastname phonenumber adress')
    info = input().split()
    pickle.dump(info, open(info[0].lower() + '.pkl' , 'w+'))
    continue
elif choice == 2:
    print('What is their first name?')
    fn = input().lower()
    x = pickle.load(open(fn + '.pkl', 'rb'))
    print(x[0] + x[1] + x[2] + x[3])
    continue
elif choice == 3:
    break
else:
    print('Invalid input.')
    continue
</code></pre>

<p>The error says: </p>

<pre><code>Traceback (most recent call last):
  File "C:\Users\keith\Desktop\adress_book.py", line 13, in &lt;module&gt;
    info = input().split()
  File "&lt;string&gt;", line 1
    Bob Smith 123456789 123street
            ^
SyntaxError: invalid syntax
</code></pre>

<p>Any help would be greatly appreciated, thanks.</p>

<p>I think you're looking for <a href="https://docs.python.org/2/library/functions.html#raw_input" rel="nofollow"><code>raw_input</code></a>. Unlike in Python 3, in Python 2.x, <a href="https://docs.python.org/2/library/functions.html#input" rel="nofollow"><code>input</code></a> parses and evaluates the string as a Python expression.</p>

<p>From the <code>input</code> docs:</p>

<blockquote>
  <p>This function does not catch user errors. If the input is not syntactically valid, a <code>SyntaxError</code> will be raised.</p>
</blockquote>

python python-2.7