How can you write the symbol "¿" in a manageable text string in Python 2.7?
How can you write the symbol "¿" in a manageable text string in Python 2.7?
Add the following lines to the beginning of the file to be able to use UTF-8 in strings and comments:
#!/usr/bin/python
# -*- coding: utf-8 -*-
You must add the coding in the first lines, for that matter the encoding would be utf-8. The following example will print the "How is it going with Python?".
#!/usr/bin/python
# -*- coding: utf-8 -*-
texto = "¿Como va todo con Python?"
print texto
I hope I have helped you, Regards.