Skip to content Skip to sidebar Skip to footer

Appending Strings From Json Object On A Condition Together Efficiently?

So I have an array of json objects that look like: data = [{key1: 123, key2:'this is the first string to concatenate'}, {key1: 131, key2:'this is the second string to concatenate

Solution 1:

all_key2 = " ".join([elem["key2"] for elem in data if langid.classify(elem["key2"])=="english"])

Post a Comment for "Appending Strings From Json Object On A Condition Together Efficiently?"