How do I print the docstring of my python module file, from my main file? Let's say I have a python module file called Projectile.py, which defines a class inside it called Projectile. Then I have another python file called main.py. In main, I want to access the module level docstring. How do I do this?
I know how to print the docstring for the class and the methods.
For example, to print the class level docstring from my main file, it would just be:
print(Projectile.__doc__)
Output: This is the class docstring: Simulates the flight of simple projectiles near the earth's surface, ignoring wind resistance. Tracking is done in two dimensions, height (y) and distance (x).
But how to print the module level docstring?? Thanks!
"""This is the module docstring"""
from graphics import *
from math import *
class Projectile:
"""This is the class docstring: Simulates the flight of simple projectiles near the earth's surface,
ignoring wind resistance. Tracking is done in two dimensions, height (y) and distance (x)."""
# Constructor - TO INITIALIZE INSTANCE VARIABLES
"""This is the constructor docstring"""
def __init__(self, angle, velocity, height):
self.initialVelocity = velocity
self.xpos = 0.0