在做基于情感词典的打分学习。当分值为6.5 时 输出总是7。在看了代码后才发现,程序中有 result = round(result, 1),才发现round函数时python中的一个output function. but, there are some different situation in practice.
round(result, 1) means that reserves a decimal fraction
for example, in python 3, round(1.0/2.0 ) will print 1. but in python 2, the result of round (1.0/2.0) will print 0.
in addition, have some other situation in practice. i will be continue to study.
round() function
最新推荐文章于 2024-04-14 21:42:15 发布