2

I was trying something and I get this error. I searched and i found I have to add # encoding=utf8 but the output was different from what I was expecting

My code:

print ' -------\n│      │\n│      │\n│     │\n││      │\n ------'

First error:

SyntaxError: Non-ASCII character '\xe2' in file prueba.py on line 3, but 
no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Code output:

-------
Ôöé      Ôöé
Ôöé      Ôöé
Ôöé     Ôöé
ÔöéÔöé      Ôöé
------
2
  • I don't have the problem, I can just print it and get the expected result. I guess the problem is you define to use utf8 but don't use a utf8 string. Maybe try to say print u' -------\n│ │\n│ │\n│ │\n││ │\n ------' Commented Nov 10, 2015 at 15:20
  • thank you so much, I try your solution and it works Commented Nov 10, 2015 at 15:26

1 Answer 1

1

I guess the problem is you define to use utf8 but don't use a utf8 string. Maybe try to say print u' -------\n│ │\n│ │\n│ │\n││ │\n ------'

Sign up to request clarification or add additional context in comments.

1 Comment

If this answer solved your problem, you might want to accept it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.