→ lycantrope: 在你產生a的時候就決定跳脫字串 沒有所謂的後來才加r 03/29 23:05
→ Hsins: 雖然看不是很懂問題, 但我猜你想找的是 repr() 03/29 23:05
→ Hsins: 一樓說的是 literal string 不跳脫的話, 連變數都放不進去 03/29 23:07
→ Hsins: 也就沒有你的問題了;而 repr() 是可以印出含跳脫字元的形 03/29 23:08
→ Hsins: 式 03/29 23:08
→ lycantrope: 我猜原po在想把a = "\032823" 會變成"\x1a832"後的a 03/29 23:21
→ lycantrope: 轉回成 "\\032832" 03/29 23:21
是的
※ 編輯: holmes3 (36.234.22.251 臺灣), 03/29/2023 23:35:32
推 poototo: 一個unicode可以表示成多種進位編碼的escape 03/30 00:59
→ poototo: 一對多,只有你自己知道要還原表示成甚麼raw string 03/30 01:00
推 HuangJC: ‘’ 是什麼? 寫程式時 引號 要精確點,你這裡雙引號只 03/31 12:08
→ HuangJC: 出現一次,因此這個字串根本沒框好,我看不懂這是什麼.. 03/31 12:08