Python 2.7.3 and 3.2.3 on Ununtu 12.04 string problem

This is the place for queries that don't fit in any of the other categories.

Python 2.7.3 and 3.2.3 on Ununtu 12.04 string problem

Postby Robinzon Kruso » Sat Feb 01, 2014 9:02 pm

Hi

I have started to use Ubuntu 12.04 a bit and evrything was ok until I have started to use Python 2.7.3 which is by default installed on Ubuntu 12.04.
I have problem with simple string interpretation as follow:

Python 2.7.3
>>> a=¨some string¨
File "<stdin>", line 1
a=¨some string¨
^
SyntaxError: invalid syntax
>>>


or
>>> print ¨some string¨
File "<stdin>", line 1
print ¨some string¨
^
SyntaxError: invalid syntax
>>>


Python 3.2.3
>>> a = ¨some string¨
File "<stdin>", line 1
a = ¨some string¨
^
SyntaxError: invalid character in identifier
>>>

or
>>> print (¨some string¨)
File "<stdin>", line 1
print (¨some string¨)
^
SyntaxError: invalid character in identifier
>>>



So if you can see I cannot assigne any string to the variable which in Windows was without problems. I have installed Python 3.2.3 and still I cannot use string. So probably I´m missing some module...

Can somebody tell me what´s going on and is any solution to solve this... Before I post this problem hier I have searched for a solution on internet but I couldn´t find anything.

Thanks in advance
Robinzon Kruso
 
Posts: 3
Joined: Fri Jan 10, 2014 2:16 pm

Re: Python 2.7.3 and 3.2.3 on Ununtu 12.04 string problem

Postby metulburr » Sat Feb 01, 2014 11:10 pm

Code: Select all
>>> print (¨some string¨)
File "<stdin>", line 1

There is a major difference in your string quotation marks in your print and the traceback's double string quotation marks. The two quotation marks below are different, even though they are both double quotation marks


Code: Select all
"

Code: Select all
¨


http://en.wikipedia.org/wiki/Quotation_mark_glyphs
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1469
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Python 2.7.3 and 3.2.3 on Ununtu 12.04 string problem

Postby micseydel » Mon Feb 03, 2014 3:24 am

This looks like you've copy-pasted it from somewhere strange, probably a PDF? As metulburr pointed out the characters aren't compatible with Python. If you type code as someone normally would you probably won't have this problem.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1354
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron