I am using Python 3.2.2 in Xcode 4.2 (build 4D199) on Mac OS X 10.7.2 and as follows:
main.py
#coding=utf-8
print("ľťď", 1+1)
print("ľťď")
Output in the console (Shift+Cmd+C):
('\xc4\xbe\xc5\xa5\xc4\x8f', 2)
ľťď
Expected output (eg IDLE works well):
ľťď 2
ľťď
Now given the fact that it also includes the brackets, apostrophes and comma, I presume that this behaviour is a result of the console's debugging nature, hence the real question is probably how to make the console to show the final output. The behaviour however seems a bit inconsistent and since this is my first encounter with Xcode and Python, my question is rather broad.
TL;DR: Is it possible to make the Xcode's console to output the same as eg IDLE?
Now given the fact that it also includes the brackets, apostrophes and comma, I presume that this behaviour is a result of the console's debugging nature
It's not. This is the difference between Python 2 and 3.
$ python2
>>> print("ľťď", 1+1)
('\xc4\xbe\xc5\xa5\xc4\x8f', 2)
$ python3
>>> print("ľťď", 1+1)
ľťď 2
You're actually running two different Python versions. Since Python 3 is not backwards compatible, you should pick either 2 or 3 for your project and stick with it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.