How can I make a variable private in python?

0 votes
Is there a way to override the methods and call the private variables in a class in python?
Jul 11 in Python by Waseem
• 4,480 points
23 views

1 answer to this question.

0 votes

Python does not have any private variables like C++ or Java does. You could access any member variable at any time if wanted, too. However, you don't needprivate variables in Python, because in Python it is not bad to expose your classes member variables

answered Aug 2 by Mohammad
• 3,060 points

Related Questions In Python

0 votes
0 answers

How can I make a simple webapp in python?

What is the difference between a microframework ...READ MORE

May 22 in Python by Waseem
• 4,480 points

edited May 23 by Omkar 16 views
0 votes
1 answer

How can I change the iteration variable inside a for loop in python?

Assume you have a list of lists: my_list ...READ MORE

answered Jun 10 in Python by Shubham Bansal
34 views
+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

answered Mar 31, 2018 in Python by DareDev
• 6,810 points
132 views
+2 votes
2 answers

How can I create a new file in Python?

You can try the below code which ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,420 points
93 views
+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 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 232 views
+4 votes
6 answers
0 votes
1 answer

How can I write a program to add two numbers using functions in python?

def add(a,b):      return a + b #when i call ...READ MORE

answered May 20 in Python by Mohammad
• 3,060 points
77 views
0 votes
1 answer

How can I find the square of a number in python?

You can use the exponentiation operator or ...READ MORE

answered May 20 in Python by Mohammad
• 3,060 points
31 views