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 229 views
1 answer 159 views
2 answers 182 views
1 answer 170 views
1 answer 171 views
...