The pprint.pformat()... «Automate the Boring Stuff with Python: Practical Programming for Total Beginners»
ska3o4nik25 декабря 2020The pprint.pformat() function produces a string that itself is formatted as valid Python code. By outputting it to a text file named census2010.py, you’ve generated a Python program from your Python program! This may seem complicated, but the advantage is that you can now import census2010.py just like any other Python module.
55