Deeemo 发表于 2021-12-16 22:05:44

关于decimal模块使用

import decimal
a = decimal.Decimal('0.1')
b = decimal.Decimal('0.2')
print (a + b)
SyntaxError: multiple statements found while compiling a single statement

萌新不是很懂为什么这个问题会产生,是decimal模块引入有问题吗?

冬雪雪冬 发表于 2021-12-16 22:12:39

错误的原因是在交互模式,通过粘贴输入多行语句。解决方法:
1.新建一个程序,在程序中输入。
2.交互模式,一次一行的输入或粘贴。
页: [1]
查看完整版本: 关于decimal模块使用