Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python replace accented characters code

import unicodedata

def strip_accents(text):

    try:
        text = unicode(text, 'utf-8')
    except NameError: # unicode is a default on python 3 
        pass

    text = unicodedata.normalize('NFD', text)
           .encode('ascii', 'ignore')
           .decode("utf-8")

    return str(text)

s = strip_accents('àéêöhello')

print s
Comment

PREVIOUS NEXT
Code Example
Python :: check if string contains alphabets python 
Python :: left join outer apply 
Python :: flatten a 2d list 
Python :: how to pause time in python 
Python :: pandas test for nan 
Python :: python correlation between features and target 
Python :: keras.layers.MaxPool2D 
Python :: python palindrome 
Python :: string hex to decimal python 
Python :: python use variable in regex expression 
Python :: plot.barh() group by 
Python :: api in python 
Python :: tkinter messagebox 
Python :: python random hash 
Python :: pycairo 
Python :: pyqt5 image 
Python :: roots of quadratic equation in python 
Python :: how to make calculator in python 
Python :: random python 
Python :: MovieWriter stderr: ffmpeg: error while loading shared libraries: libopenh264.so.5: cannot open shared object file: No such file or directory 
Python :: python check if two lists intersect 
Python :: are tuples mutable 
Python :: how to read then overwrite a file with python 
Python :: feature scaling in python 
Python :: godot setget 
Python :: get all file in folder python 
Python :: create new dataframe from existing dataframe pandas 
Python :: python groupby sum single columns 
Python :: numpy count occurrences in array 
Python :: how to delete role discord py rewrite 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =