# Displaying the repeating decimal expansion of a rational number [duplicate]

How do I write a decimal expansion of a rational number $$a/b$$ with only periodic part, e.g., given $$1/7=0.14285714285714285714 \ldots$$, I want just $$0.142857$$, the periodic part of $$1/7$$, to be displayed. I think I was able to do it sometime ago (with RealDigit or something similar), but now I forget what I did.

For integers and rational numbers with terminating digit expansions, RealDigits[x] returns an ordinary list of digits. For rational numbers with non‐terminating digit expansions, it yields a list of the form {a1,a2,…,{b1,b2,…}} representing the digit sequence consisting of the ai followed by infinite cyclic repetitions of the bi
Print@RealDigits[1/7]