我有以下代碼片段: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"為什么反斜杠重復(fù)?根據(jù)這個網(wǎng)站,\\在一個格式內(nèi)應(yīng)該 yield \。
1 回答

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