Is there a way to list out in-built variables and functions of Python?

0 votes

Hi. I recently found out about the dir() method that lists out the names that a module provides. To use this, you need to import a module and then use the dir() method. 

import datetime
dir(datetime)

I was just wondering if there is a way to list out the in-built functions. Because, we don't import any module to use the in-built functions or names, so how can we list the in-built names?

May 14, 2019 in Python by Yash
83 views

1 answer to this question.

0 votes

The in-built variables and functions are defined in the builtins modules. So you can use the dir() method on this module to list the names. For example:

>>> import builtins
>>> dir(builtins)
answered May 14, 2019 by Junaid

Related Questions In Python

0 votes
1 answer

Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,760 points
128 views
0 votes
1 answer

Is there a way to loop between 0 and 1 by 0.1 in python?

You can use the linespace function. It ...READ MORE

answered May 27, 2019 in Python by Olly
123 views
0 votes
1 answer

What is the recommended way to randomize a list of strings using Python?

Hi. Nice question. Here is the simplified answer ...READ MORE

answered Jan 18, 2019 in Python by Nymeria
• 3,540 points
77 views
0 votes
1 answer

how to sort a list of numbers without using built-in functions like min, max or any other function?

Yes it is possible. You can refer ...READ MORE

answered Jun 27, 2019 in Python by Arvind
• 2,980 points
1,866 views
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 771 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

How to get permutations of list or a set in Python?

Permutation is an arrangement of objects in ...READ MORE

answered Jul 11, 2019 in Python by Neel
• 3,010 points
645 views