Answers for "python remove unicode from string"

22

python remove last characters from string

st =  "abcdefghij"
st = st[:-1]  // Returns string with last character removed
Posted by: Guest on April-11-2020
0

python remove all unicode from string

return ''.join([i if ord(i) < 128 else ' ' for i in text])
Posted by: Guest on June-02-2020
0

strip unicode characters from strings python

def strip_non_ascii(string):
    ''' Returns the string without non ASCII characters'''
    stripped = (c for c in string if 0 < ord(c) < 127)
    return ''.join(stripped)


test = u'éáé123456tgreáé@€'
print test
print strip_non_ascii(test)
Posted by: Guest on September-04-2020

Code answers related to "python remove unicode from string"

Python Answers by Framework

Browse Popular Code Answers by Language