From anonymous, 6 Years ago, written in Python.
This paste is a reply to Untitled from anonymous
- go back
Embed
Viewing differences between Untitled and Re: Untitled

result = []
terms = ['term1','term2','term3','term4']
text = 'term1 :value1term2 :value2term3 :term4 :value4'
for (i, term) in enumerate(terms):
            # Strip everything before current terminal
        if i == 0:
                
terminal
    
t = text.lstrip(term)
        else:
                t = text.
split(term)[1]
            """
    if i == 0:
        t = text.lstrip(term)
    else:
        t = text.split(term)[1]
    """
    
# Strip the next terminal and everything after it
        
it
    
if i != len(terms)-1:
                
len(terms)-1:
        
t = t.split(terms[i+1])[0]
            t = t.lstrip(" :")
            result.append(t)
print(result)