I have two list of same length l1=[reboot,revision,disk_space] and l2=[no,12.15,4300] I want to make these two list as key-value map. Output should be like this [reboot:no,revision:12.18,disk_space:4300].. I tried Zip it is not working
            Asked
            
        
        
            Active
            
        
            Viewed 425 times
        
    -4
            
            
         
    
    
        Cristian Lupascu
        
- 39,078
- 16
- 100
- 137
1 Answers
0
            
            
        You can create a dictionary from the output of zip (Thanks, Martijn!):
print dict(zip(l1, l2))
 
    
    
        Cristian Lupascu
        
- 39,078
- 16
- 100
- 137
- 
                    1or simpler yet: `dict(zip(l1, l2))`. – Martijn Pieters Mar 20 '15 at 08:22
- 
                    when i tried this it always gives the output like this r:no,r:12.18,d:4300. It always takes the first letter as key and ignore the rest – Varsha Anandani Mar 23 '15 at 09:59
- 
                    @VarshaAnandani Provide your full, runnable python code, or better still, a working ideone.com link. – Cristian Lupascu Mar 23 '15 at 11:07
