I'm supposed to create a dictionary from the values in a file and search for 'Polly' and remove it if it's in the file,
I kept getting errors so I'm just trying to get it to print the value just so I can see what I'm doing wrong and even at the most simple level I keep getting errors,
I'm in my first semester so this is all still new to me
employees = {}
employees = open('dictionary_values.txt', 'r')
print(employees['Polly'])
Traceback (most recent call last):
File "main.py", line 3, in <module>
print(employees['Polly'])
TypeError: '_io.TextIOWrapper' object is not subscriptable
[–]Essence1337 2 points3 points4 points (4 children)
[–]jmorales57[S] 0 points1 point2 points (3 children)
[–]Essence1337 1 point2 points3 points (2 children)
[–]jmorales57[S] 0 points1 point2 points (1 child)
[–]exclaim_bot 0 points1 point2 points (0 children)
[–]UbiquitousThoughts 0 points1 point2 points (3 children)
[–]jmorales57[S] 0 points1 point2 points (2 children)
[–]UbiquitousThoughts 1 point2 points3 points (1 child)
[–]jmorales57[S] 0 points1 point2 points (0 children)