1my_dict = {'foo': 'bar', 'spam': 'eggs'}
2next(iter(my_dict)) # outputs 'foo'
3
4# or
5
6my_dict = {'foo': 'bar', 'spam': 'eggs'}
7list(my_dict.keys())[0] # outputs 'foo'
1# Dictionary of string and int
2word_freq = {
3 'Hello' : 56,
4 "try" : 23,
5 'test' : 43,
6 'This' : 78,
7 'Way' : 11
8}
9# Get first value from dictionary
10first_value = list(word_freq.values())[0]
11print('First Value: ', first_value)
12
13# Output:
14# First Value: 56