SyntaxError: Non-ASCII character ‘\xa3’ in file when function returns ‘£’

Say I have a function:

def NewFunction():
    return '£'

I want to print some stuff with a pound sign in front of it and it prints an error when I try to run this program, this error message is displayed:

SyntaxError: Non-ASCII character '\xa3' in file 'blah' but no encoding declared;
see http://www.python.org/peps/pep-0263.html for details

Can anyone inform me how I can include a pound sign in my return function? I’m basically using it in a class and it’s within the '__str__' part that the pound sign is included.

6 Answers
6

Leave a Comment