我正在用python词典编写一本英语到我的母语词典。在使用键值对时,我希望能够在值中设置某些单词的样式,例如,第一个值中大写的单词。我试图在目标文本之前的“\033[1m”和之后的“\033[0m”之前添加ANSI转义序列,但仍然不起作用;相反,序列代码是打印出来的。 我该怎么做?谢谢。下面是这本词典的摘录:
#Dictionary
exlist={
"drum":"\033[1m DRUM \033[0m: (with skin) ŋgɔ̀m; (long, single-headed, skin-covered) ɨbûm ŋgɔ̀m; (with one end) ŋgɔ̀m ə̀tu",
"bag":"BAG: (n) ə̀bàmɨ̀ pl. ɨ̀bàmɨ̀; (assp) (fibre bag) ə̀bàmɨ̀ tɨswé; (a type of bag made of animal skin) ndoŋ",
"ant":"ANT: ɨgwírɨ́ (pl. əgwirɨ); (has a big croup) ɨgwírɨ́ ndiŋ; (ant species, very small, attack and destroy white ants)"
}
这是如何在Tkinter中加粗/下划线/斜体文本:
相关问题 更多 >
编程相关推荐