Python 的 chr(~)
方法返回所提供的 Unicode 代碼點的相應字符。
參數
1. i
| integer
表示要返回的字符的 Unicode 代碼點的整數。有效範圍為 0
- 1114111
。
返回值
與輸入 Unicode 代碼點對應的字符串字符。
例子
基本用法
要返回 Unicode 代碼點 287
的字符串:
chr(287)
'ğ'
ValueError
要返回 Unicode 代碼點 1114112
的字符串:
chr(1114112)
ValueError: chr() arg not in range(0x110000)
由於提供的 Unicode 代碼點超出了有效範圍,因此返回ValueError
。
相關用法
- Python chr()用法及代碼示例
- Python NumPy char find方法用法及代碼示例
- Python NumPy char less_equal方法用法及代碼示例
- Python NumPy char greater方法用法及代碼示例
- Python NumPy char equal方法用法及代碼示例
- Python NumPy char lower方法用法及代碼示例
- Python NumPy char less方法用法及代碼示例
- Python Wand charcoal()用法及代碼示例
- Python NumPy choose方法用法及代碼示例
- Python NumPy char split方法用法及代碼示例
- Python NumPy char greater_equal方法用法及代碼示例
- Python NumPy char multiply方法用法及代碼示例
- Python NumPy char upper方法用法及代碼示例
- Python NumPy char not_equal方法用法及代碼示例
- Python NumPy char isupper方法用法及代碼示例
- Python NumPy char add方法用法及代碼示例
- Python numpy chararray.tostring用法及代碼示例
- Python numpy char.chararray.tostring用法及代碼示例
- Python NumPy char count方法用法及代碼示例
- Python NumPy char rjust方法用法及代碼示例
- Python NumPy choice方法用法及代碼示例
- Python NumPy char rstrip方法用法及代碼示例
- Python NumPy char ljust方法用法及代碼示例
- Python cudf.core.column.string.StringMethods.is_vowel用法及代碼示例
- Python cudf.Series.ceil用法及代碼示例
注:本文由純淨天空篩選整理自Arthur Yanagisawa大神的英文原創作品 Python | chr method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。