如何使用 Python 查詢字元的 ASCII 值?
python 中的 ord 函式提供字元(ASCII)的序數值。你可以使用此函式如下查詢 ascii 碼
示例
s = "Hello" for c in s: print(ord(c))
輸出
這將輸出
72 101 108 108 111
廣告
python 中的 ord 函式提供字元(ASCII)的序數值。你可以使用此函式如下查詢 ascii 碼
s = "Hello" for c in s: print(ord(c))
這將輸出
72 101 108 108 111