How can I convert a string, say "HELLO"
, into something like this?
As ASCII string: "72_69_76_76_79"
.
I tried [ord(c) for c in string]
, but it returns a list.
I want the result in the form of string
你可以使用这个:
"_".join([str(ord(c)) for c in "HELLO"])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.