I have a integer value i.e. 1010110. How to treat this value as binary? So that i can find the integer value of that binary value.
            Asked
            
        
        
            Active
            
        
            Viewed 49 times
        
    1 Answers
0
            
            
        You can pass a base parameter (2 in this case) to the int function:
s = "1010110"
i = int(s, 2)
# 86
 
    
    
        user2390182
        
- 72,016
- 6
- 67
- 89
