how to convert a sting of the format "[u'logic', u'jackpot']" into a list of the format ['logic', 'jackpot']? 
Note: "".split() didn't work. It gave me: ["[u'logic',",
 "u'jackpot',", "u'420',", "u'pvp", "label',", "u'cassius", "cake',", "u'pod",
 "vlivem',", "u'EP',", "u'yzo',", "u'hank", "moody']"]
            Asked
            
        
        
            Active
            
        
            Viewed 47 times
        
    0
            
            
        1 Answers
3
            You can use the safe literal_eval from ast like so:
from ast import literal_eval as leval
print(leval("[u'logic', u'jackpot']"))  # -> ['logic', 'jackpot']
 
    
    
        Ma0
        
- 15,057
- 4
- 35
- 65
 
    