+ 1

Accent and ñ in python

If I want to put something like print("nĂșmero") or print("año") Python trows an SyntaxError. How can I write ĂĄ, Ă©, Ă­, Ăł, Ăș and the ñ without an error?

29th Jan 2021, 12:25 AM
Carmen LucĂ­a
Carmen LucĂ­a - avatar
3 Answers
+ 5
in wich context are you running those statements? wich version of python? 2? 3? ...as playground here, and at least python 3 anywhere should good handle accentuated characters ^^
29th Jan 2021, 12:42 AM
visph
visph - avatar
+ 2
and probably under window, I guess ;)
29th Jan 2021, 12:52 AM
visph
visph - avatar
+ 1
Oh it makes sense... I was running python 2.7 and that was the problem... Thanks :)
29th Jan 2021, 12:49 AM
Carmen LucĂ­a
Carmen LucĂ­a - avatar