turtle.write_docstringdict() function in Python
The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
This method is used to Create and write a docstring-dictionary to file.
Has to be called explicitly, (not used by the turtle graphics classes). The docstring dictionary will be written to the Python script <filename>.py. It is intended to serve as a template for translation of the docstrings into different languages.
Below is the implementation of the above method with an example :
Here, we can see an output file with the name “turtle_docstringdict.py” which stores the description of turtle methods with examples. All the content is stored in the form of a dictionary ( Key-Value pair ) where :
- Key: method name
- Value: Description with examples