【发布时间】:2017-02-26 02:00:37
【问题描述】:
我在 python 中有一个字符串
set = "U+06A4, U+06A7, U+06A8, U+06A9, U+06AF"
我想在这个字符串中找到所有以U+ 开头的单词,并将它们附加到相应的字形中。
比如说
word_found_in_string = 'U+064A'
我想换成
replace_with = 'U+064A chr(int(word_found_in_string[2:6],16))'
chr(int(word_found_in_string[2:6],16)) 在我的输出文件中打印相应的字形。
如何使用re 模块对字符串中的所有 unicode 代码点执行此操作,以便生成的字符串中的所有代码点都附加了相应的字形?
【问题讨论】:
标签: regex python-3.x unicode