Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

two underscores python

>>> class MyClass():
...     def __init__(self):
...             self.__superprivate = "Hello"
...             self._semiprivate = ", world!"
...
>>> mc = MyClass()
>>> print mc.__superprivate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: myClass instance has no attribute '__superprivate'
>>> print mc._semiprivate
, world!
>>> print mc.__dict__
{'_MyClass__superprivate': 'Hello', '_semiprivate': ', world!'}
Comment

PREVIOUS NEXT
Code Example
Python :: Python script to SSH to server and run command 
Python :: return function in python 
Python :: draw bipartite graph networkx 
Python :: flask multuple parameters 
Python :: Python difference between filter and map 
Python :: sqlite query using string as parameter in python 
Python :: np logical not 
Python :: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. 
Python :: python generators 
Python :: create tuples in pandas 
Python :: Iterating With for Loops in Python 
Python :: django form custom validation 
Python :: spliting the text to lines and keep the deliminaters python 
Python :: get date only from datetimefiel django 
Python :: extract specific key values from python dictionary 
Python :: defaultdict item count 
Python :: numpy diag() 
Python :: remove python 2.7 centos 7 
Python :: python qr scanner 
Python :: opening a file in python 
Python :: what is * in argument list in python 
Python :: make button in tk 
Python :: split a column in pandas 
Python :: is there a null data type in python 
Python :: i++ in python 
Python :: how to make loops in python 
Python :: python list append() 
Python :: issubclass python example 
Python :: 3d data visualization python 
Python :: itertools count 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =