Created
June 29, 2018 19:18
-
-
Save aaltat/bb979a12e70a86a06ede8e65d19dc57b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_keyword(dlist): | |
selected = [] | |
for dict_item in dlist: | |
platform = dict_item['platforms'] | |
if 'mac' in platform and dict_item['language'] == 'en': | |
selected.append(dict_item) | |
elif 'all_platforms' in platform: | |
selected.append(dict_item) | |
return selected | |
if __name__ == '__main__': | |
d1 = {'intent': 'Complex.Checkpoint', | |
'language': 'en', | |
'locations': ['worldwide', 'us_imt'], | |
'name': 'HELP@IBM_APPLICATION', | |
'platforms': ['all_platforms', 'mac', 'win10', 'win7'], | |
'queryString': 'Checkpoint%20and%20GBS%20PA', | |
'text': ['Checkpoint and GBS PA', | |
'Checkpoint and GBS PA', | |
'How do I access checkpoint?', | |
"I can't log in to checkpoint", | |
"I'm having problems with checkpoint", | |
'I need help with checkpoint', | |
'I need help with my annual assessment', | |
'I need help with my performance rating', | |
'I need help with project assessment', | |
'I need to access my old pbc assessments', | |
'I received an error while using checkpoint', | |
'performance assessment', | |
'What is checkpoint tracker?', | |
'Where is pbc?'], | |
'workspace': 'f96dedf4-ace4-4630-85be-3c011bbe122b'} | |
d2 = {'intent': 'Complex.Checkpoint', | |
'language': 'en', | |
'locations': ['worldwide', 'us_imt'], | |
'name': 'HELP@IBM_APPLICATION', | |
'platforms': ['win10', 'win7'], | |
'queryString': 'Checkpoint%20and%20GBS%20PA', | |
'text': ['Checkpoint and GBS PA', | |
'Checkpoint and GBS PA', | |
'How do I access checkpoint?', | |
"I can't log in to checkpoint", | |
"I'm having problems with checkpoint", | |
'I need help with checkpoint', | |
'I need help with my annual assessment', | |
'I need help with my performance rating', | |
'I need help with project assessment', | |
'I need to access my old pbc assessments', | |
'I received an error while using checkpoint', | |
'performance assessment', | |
'What is checkpoint tracker?', | |
'Where is pbc?'], | |
'workspace': 'f96dedf4-ace4-4630-85be-3c011bbe122b'} | |
d3 = {'intent': 'Complex.Checkpoint', | |
'language': 'en', | |
'locations': ['worldwide', 'us_imt'], | |
'name': 'HELP@IBM_APPLICATION', | |
'platforms': ['all_platforms'], | |
'queryString': 'Checkpoint%20and%20GBS%20PA', | |
'text': ['Checkpoint and GBS PA', | |
'Checkpoint and GBS PA', | |
'How do I access checkpoint?', | |
"I can't log in to checkpoint", | |
"I'm having problems with checkpoint", | |
'I need help with checkpoint', | |
'I need help with my annual assessment', | |
'I need help with my performance rating', | |
'I need help with project assessment', | |
'I need to access my old pbc assessments', | |
'I received an error while using checkpoint', | |
'performance assessment', | |
'What is checkpoint tracker?', | |
'Where is pbc?'], | |
'workspace': 'f96dedf4-ace4-4630-85be-3c011bbe122b'} | |
dlist = [d1, d2, d3] | |
selected = my_keyword(dlist) | |
print(len(selected)) | |
for item in selected: | |
print(item) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment