denote #32.1dot2dot3dot5# as #x#.
#x = 32.1dot2dot3dot5#
multiply by #10#:
#10x = 321.dot2dot3dot5#. that way, you'll have all of the repeating pattern on the side after the decimal point.
then multiply by #1000#:
#10000x = 321235.dot2dot3dot5#. that way, you'll have a larger number with the exact same repeating pattern, after the decimal point.
the advantage of this is that you can easily subtract the two, to get a whole number:
#321235.dot2dot3dot5 - 321.dot2dot3dot5 = 321235 - 321 = 320914#
#10000x - 10x = 9990x#
this means that #9990x = 320914#
you can divide both sides by #2# to give #4995x = 160457#
this cannot be simplified further, since #4995# and #160457# have no common factors.
hence, #p/q# as stated in the question would be #160457/4995#.
and indeed, putting #160457/4995# into a calculator would give you the recurring decimal #32.1235235...#, or #32.1dot2dot3dot5#.