我有以下代碼片段:const byte1 = 0x19;const byte2 = 0x45;msg := fmt.Sprintf("\\x%x\\x%x message", byte1, byte2)log.Info("Learning go fmt", "msg", msg)我明白了:msg="\\x19\\x45 message"為什么反斜杠重復?根據這個網站,\\在一個格式內應該 yield \。
1 回答

臨摹微笑
TA貢獻1982條經驗 獲得超2個贊
問題是我正在使用以太坊日志包。它取消了字符串。如果我做:
fmt.Println("\\x%x\\x%x?message",?byte1,?byte2)
它工作得很好。
- 1 回答
- 0 關注
- 115 瀏覽
添加回答
舉報
0/150
提交
取消