我遇到像3.333333333那样的浮点数问题,我想把它变成3.33.我不想改变Serializer这类价值来自的所有类.有数千个序列化器,它们有多个字段,其值为3.333333333.
Serializer
你能帮我找一下猴子补丁类型的解决方案,这样我就可以编写一个类或函数来转换浮点值.
python django json monkeypatching django-rest-framework
它背后有什么逻辑吗?
>>>'a' and 'b' and 'c' 'c' >>>'a' or 'b' or 'c' 'a'
python python-2.7
python ×2
django ×1
django-rest-framework ×1
json ×1
monkeypatching ×1
python-2.7 ×1