How to encode a string to ASCII in Python

1 Answer

0 votes
s = "Python åäöÅÄÖ"
 
es = s.encode(encoding='ascii', errors='ignore')
 
print(es)
 
 
'''
run:
 
b'Python '
 
'''

 



answered Nov 4, 2021 by avibootz

Related questions

2 answers 225 views
1 answer 148 views
2 answers 173 views
1 answer 164 views
1 answer 164 views
...