使用fractions(分数)模块,可以进行分数运算。使用fractions模块中的Fraction()函数可以将小数转换成分数。2.75转换成分数是多少?from fractions import Fraction print(Fraction(2.75))执行结果:11/4