I have a list of about 50 strings with an integer representing how frequently they occur in a text document. I have already formatted it like shown below, and am trying to c
Like this, Python's dict() function is perfectly designed for converting a list of tuples, which is what you have:
list
tuple
>>> string = [('limited', 1), ('all', 16), ('concept', 1), ('secondly', 1)] >>> my_dict = dict(string) >>> my_dict {'all': 16, 'secondly': 1, 'concept': 1, 'limited': 1}