xXJohnRamboXx
xXJohnRamboXx

Reputation: 739

python '\xb4' encoding issue

In python i'm not able to print the grave accent. When i try to print it i get this exception:

SyntaxError: Non-UTF-8 code starting with '\xb4' in file C:\Users\myuser\file.py on line 61, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Actually in my python file i am trying to print this:

def graveAccent(message):
    print('`'+message+'´')

my question is: how can i print the grave accent? thanks

UPDATE: python version is 3.7 and "message" content is "Hello"

Upvotes: 0

Views: 999

Answers (1)

Kostas Charitidis
Kostas Charitidis

Reputation: 3103

'\xb4' is the character you're trying to print inside your quotations (`), it has nothing to do with your message, but this should only be a problem in python 2.* and for sure not in 3.7. Nevertheless try to add encoding on top of your code:

#encoding=utf-8

Upvotes: 1

Related Questions