from fractions import Fraction  
value = 4.2  
print(Fraction(value).limit_denominator()) 

 

相关文章: