Open In App

turtle.write_docstringdict() function in Python

Improve
Improve
Like Article
Like
Save
Share
Report

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.

turtle.write_docstringdict()

This method is used to Create and write a docstring-dictionary to file.

Syntax:

turtle.write_docstringdict(filename='turtle_docstringdict')

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 :

Python3




# importing package
import turtle
  
# making docstringdictionary file
turtle.write_docstringdict(filename='turtle_docstringdict')


Output :

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

Last Updated : 19 Oct, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads