Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyEnDecode
#python 3.6.9 #PyEnDecode: example of encoding strings and decoding byte sequence #this code is created by Rezaul Hoque on May 02,2022. #contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; s='Pইthon string এncoding এxample' print("Encoding strings into sequence of bytes:\n") encS=s.encode('utf-8','strict') encS2=s.encode('ascii','replace') encS3=s.encode('utf-8','ignore') encS4=s.encode('utf-8','backslashreplace') encS5=s.encode('ascii','namereplace') encS6=s.encode('ascii','xmlcharrefreplace') print(encS) print(encS2) print(encS3) print(encS4) print(encS5) print(encS6) print("\nDecoding stream of bytes into strings:\n") dS=encS.decode() dS2=encS2.decode('ascii','replace') dS3=encS3.decode('utf-8','ignore') dS4=encS4.decode('utf-8','backslashreplace') dS5=encS5.decode('ascii','namereplace') dS6=encS6.decode('ascii','xmlcharrefreplace') print(dS) print(dS2) print(dS3) print(dS4) print(dS5) print(dS6)
run
|
edit
|
history
|
help
0
shuru9
Python if condition
Add missing names
guessgame
26.09.2018
test1
Game2
ASCII Art
Ваня и забор
hi