wqdqw
This commit is contained in:
7
main.py
7
main.py
@@ -40,11 +40,16 @@ original_string = WXBotService.emoji_to_unicode(oldEmoji)
|
|||||||
print("original_string", original_string)
|
print("original_string", original_string)
|
||||||
# 定义正则表达式模式,匹配 \\uXXXX 形式的 Unicode 编码
|
# 定义正则表达式模式,匹配 \\uXXXX 形式的 Unicode 编码
|
||||||
unicode_regex = r'\\u([0-9a-fA-F]{4})'
|
unicode_regex = r'\\u([0-9a-fA-F]{4})'
|
||||||
|
|
||||||
# 使用正则表达式替换
|
# 使用正则表达式替换
|
||||||
converted_string = re.sub(unicode_regex, r'[@emoji=\1]', original_string)
|
converted_string = re.sub(unicode_regex, r'[@emoji=\1]', original_string)
|
||||||
print("converted_string", converted_string)
|
|
||||||
|
|
||||||
|
# 替换 \\u 为 @emoji=
|
||||||
|
converted_string = converted_string.replace('\\u', '[@emoji=')
|
||||||
|
|
||||||
|
# 在 Unicode 编码后添加 ']'
|
||||||
|
converted_string = converted_string[:-1] + ']'
|
||||||
|
print("original_string", converted_string)
|
||||||
# Dependency
|
# Dependency
|
||||||
def get_db():
|
def get_db():
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
|
|||||||
Reference in New Issue
Block a user