Python / Odoo Developer

Welcome!

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

Python Special Characters

Avatar
Administrator

Open

Fix special carachters like latin-1

accented_string = u'Málaga'
# accented_string is of type 'unicode'
import unidecode
unaccented_string = unidecode.unidecode(accented_string)
# unaccented_string contains 'Malaga'and is of type 'str'


Python os methods returns string if you give a string as input and a unicode if you use unicode as input.

Like os.listdir('PATH')   will return string

Like os.listdir(u'PATH')   will return unicode

Like os.listdir(unicode('PATH'))   will return unicode


Avatar
Abbandona