github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/md/format_int.md (about) 1 ### `format_int()` {#fn-format-int} 2 3 函数原型:`fn format_int(val: int, base: int) str` 4 5 函数说明:将数值转换为指定进制的数值字符串。 6 7 参数: 8 9 - `val`: 待转换的整数 10 - `base`: 进制,范围 2 到 36;进制大于 10 时使用小写字母 a 到 z 表示 10 及以后的数值。 11 12 示例: 13 14 ```python 15 # script0 16 a = 7665324064912355185 17 b = format_int(a, 16) 18 if b != "6a60b39fd95aaf71" { 19 add_key(abc, b) 20 } else { 21 add_key(abc, "ok") 22 } 23 24 # result 25 ''' 26 { 27 "abc": "ok" 28 } 29 ''' 30 31 # script1 32 a = "7665324064912355185" 33 b = format_int(parse_int(a, 10), 16) 34 if b != "6a60b39fd95aaf71" { 35 add_key(abc, b) 36 } else { 37 add_key(abc, "ok") 38 } 39 40 # result 41 ''' 42 { 43 "abc": "ok" 44 } 45 ''' 46 ```