<commit_before>'''
Created on Jul 2, 2014

@author: viejoemer

HowTo create an iterator from a dict in python?

¿Cómo crear un iterador de un diccionario?

'''

#Creating a dict with data
d = {
     "red":100,
     "yellow":200,
     "blue" : 300
     }
print(d)

#Create a iterator of keys
#iter(d) is similar to iter(d.keys())
d2 = iter(d)
print(d2)

for i in d2:
    print(i)

#Create a iterator of values
d2 = iter(d.values())
print(d2)

for i in d2:
    print(i)

<commit_msg>HowTo create an iterator from a dict in python?<commit_after>'''
Created on Jul 2, 2014

@author: viejoemer

HowTo create an iterator from a dict in python?

¿Cómo crear un iterador de un diccionario?

'''

#Creating a dict with data
d = {
     "red":100,
     "yellow":200,
     "blue" : 300
     }
print(d)

#Create a iterator of keys
#iter(d) is similar to iter(d.keys())
d2 = iter(d)
print(type(d2))

for i in d2:
    print(i)

#Create a iterator of values
d2 = iter(d.values())
print(type(d2))

for i in d2:
    print(i)


{'fraction_non_alphanumeric': 0.1259920634920635, 'fraction_numerical': 0.03968253968253968, 'mean_word_length': 3.293617021276596, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '47926', 'n_tokens_mistral': 425, 'n_tokens_neox': 391, 'n_words': 140}