Che Posted September 28, 2018 Report Posted September 28, 2018 Am U+1F498 care este un code unicode. Facand asa: print "&#" + str(int("0001F498", 16)) Imi arata asta: 💘 Care cica ar fi "HTML Entity (decimal): 💕" conform acestui site: https://www.fileformat.info/info/unicode/char/1f495/index.htm Stie cineva cum as putea sa fac sa imi arate 55,357 in loc de acest 128152 de mai sus ? Tot dupa situl de mai sus se pare ca ar fi un UTF-16, dar cum il pot obtine in python plecand de la unicode pointul de mai sus ? Multumesc mult de tot! 1 Quote
xzsdyx Posted September 29, 2018 Report Posted September 29, 2018 import codecs emoji=u"\U0001F498" encoded=emoji.encode('utf-16be') t=codecs.encode(encoded,'hex_codec') tt=codecs.decode(t,'ascii') prim=tt[0:4] secund=tt[4:] print("Primul numar:",int(prim,16), "Al doilea:",int(secund,16)) 1 1 Quote