Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (50.2k points)
I want to know that is it possible to view a .py as a file and present its class names, class methods, and variables as output?

1 Answer

0 votes
by (108k points)

What you can do is import the python module(that is .py file) and then call the dir python built-in function. Do not parse the input file as a text file. Let's suppose you want to list what you have in the os module you can do:

import os


 Want to be a Python expert? Join this Python Training course by Intellipaat to learn more.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.5k answers


108k users

Browse Categories