Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to access variable from another function in same class in python

class ClassName :
	function __init__(self):
    	self Num1 = 9
        Num2 = 7
        
    function getNum1(self):
    	1stNumber = Num1
        2ndNumber = Num2
        # It can't get the 2nd number because the variable doesn't have self before it
Comment

PREVIOUS NEXT
Code Example
Python :: how to cancel a input in python 
Python :: Delete the node at a given position 2 in a linked list and return a reference to the head node. The head is at position 0. The list may be empty after you delete the node. In that case, return a null value. 
Python :: python tempfile 
Python :: python no such file python3 
Python :: How to set font size of Entry in Tkinter 
Python :: how to detect an even number in python 
Python :: find width and height of imported video frame opencv2 
Python :: python get methods of object 
Python :: python testing machine learning 
Python :: django rest framework default_authentication_classes 
Python :: python append element to array 
Python :: python print user input 
Python :: python catch sigterm 
Python :: export_excel file python 
Python :: python oprators 
Python :: scikit learn k means 
Python :: python export multiple dataframes to excel 
Python :: how to output random letters in python 
Python :: python 2.7 check if variable is none 
Python :: shutil move overwrite 
Python :: sorting by second element 
Python :: dict.fromkeys with list as value 
Python :: print % in python 
Python :: strip comma from string python 
Python :: python list of integers 
Python :: python find index of minimum in list 
Python :: python convert list of strings to list of integers 
Python :: calculate nth prime number python 
Python :: how to check django rest framework version 
Python :: python how to use input 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =