I've followed the first answer on this thread:
And whenever I try and run the script, Python just closes. everything, even my other scripts I'm not working on.
Here's what I've got written, its virtually the same:
d = {}
with open("C:\Users\Owatch\Documents\Python\FunStuff\nsed.txt") as f:
for line in f:
(key, val) = line.split()
d[int(key)] = val
print(d)
The only thing I changed was the file location as that's what I understood I was to include to fix the error about not finding the file
Elaboration:
Here is the code I am supposed to use:
d = {}
with open("file.txt") as f:
for line in f:
(key, val) = line.split()
d[int(key)] = val
Here is what I did, adding a file path in place of file.txt, and having it so that it would or should print the dictionary d as soon as it's done.
d = {}
with open("C:\Users\Owatch\Documents\Python\Unisung Net Send\nsed.txt") as f:
for line in f:
(key, val) = line.split()
d[int(key)] = val
print(d)
The problem is I cannot even run this, as Python just crashes, I am running version: 3.1