亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從標簽形成 unicode 字符

從標簽形成 unicode 字符

慕碼人8056858 2022-12-14 10:51:01
我有一個簡單的語法相關問題,如果有人能回答,我將不勝感激。所以我目前有字符串格式的字符標簽:'0941'。要在 Python 中打印出 unicode 字符,我可以使用以下命令:print(u'\u0941')現在,我的問題是如何將我擁有的標簽 ('0941') 轉換為 unicode 可讀格式 (u'\u0941')?太感謝了!
查看完整描述

2 回答

?
30秒到達戰場

TA貢獻1828條經驗 獲得超6個贊

>>> chr(int('0941',16)) == '\u0941'
True


查看完整回答
反對 回復 2022-12-14
?
慕田峪4524236

TA貢獻1875條經驗 獲得超5個贊

無需使用數字鍵盤即可完成此操作的一種方法是簡單地打印字符,然后將其復制/粘貼為標簽。


    >>> print("lower case delta: \u03B4")

    lower case delta: δ

    >>> δ = 42  # copy the lower case delta symbol and paste it to use it as a label

    >>> δδ = δ ** 2  # paste it twice to define another label. 

    >>> δ  # at this point, they are just normal labels...

    42

    >>> δδ

    1764

    >>> δabc = 737  # using paste, it's just another character in a label

    >>> δ123 = 456

    >>> δabc, δ123  # exactly like any other alpha character.

    (737, 456)


查看完整回答
反對 回復 2022-12-14
  • 2 回答
  • 0 關注
  • 90 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號