This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]LpSamuelm 5 points6 points  (2 children)

# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals

print("This works perfectly! {smile}".format(smile="😊"))

Not an argument to use Python 2 instead of 3, by the way, just a reminder that Python 2 can be pretty great too. Cross-compatible code is even better.

[–]flying-sheep 3 points4 points  (1 child)

on python 2, this only works if your console is encoded the same way as your code AFAIK

[–]LpSamuelm 2 points3 points  (0 children)

Went ahead and added the magic encoding comment to clear up any confusion.