python 分数的数学四则运算

import fractions  
  
f1 = fractions.Fraction(2, 3)  
f2 = fractions.Fraction(3, 7)  
  
print('{} + {} = {}'.format(f1, f2, f1 + f2))  
print('{} - {} = {}'.format(f1, f2, f1 - f2))  
print('{} * {} = {}'.format(f1, f2, f1 * f2))  
print('{} / {} = {}'.format(f1, f2, f1 / f2))
原文地址:https://www.cnblogs.com/sea-stream/p/9966034.html