我在 python 中有一个小脚本,它利用语言环境来格式化从 1.000,00 到 1,000.00 的数字
import re, locale
locale.setlocale(locale.LC_ALL, 'es_PE.UTF-8')
locale.atof(number)
Run Code Online (Sandbox Code Playgroud)
然后当我在 Lambda 中运行它时,我收到以下错误消息:
不支持的区域设置
我知道如何通过在终端中执行以下命令在我的 PC 中安装依赖项:
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales
Run Code Online (Sandbox Code Playgroud)
我知道如何用 javascript 来做,它会类似于:
Go 函数将接收一个函数作为参数,我想获取函数作为字符串来构建一个地图,然后将其保存在某个数据库中。
package main
import (
"fmt"
)
func describe(i interface{}) string {
return fmt.Sprintf("%v", i)
}
func dummyReducer(int) int {
return 1
}
func Accumulator(reducer func(int, int) int, init int) func(int) int {
input := map[string]interface{}{
"func_name": "accumulatorLoger",
"func_data": map[string]interface{}{
"reducer": string(describe(reducer)),
"init": init,
},
}
// {
// func_data: { init: 10, reducer: '0x64b880' },
// func_name: 'accumulatorLoger'
// }
// TODO: next: save the input data in the database
fmt.Println(input)
return dummyReducer
}
Run Code Online (Sandbox Code Playgroud)