Rather than divide sequentially by 1000, 100, and finally 10, we include 900, 500, 400 etc. in our list of divisors, and modify the symbols to be saved accordingly. This idea is included in the Python Cookbook. I'm not sure who thought it up first, but it's a nice trick.
Here is the code: