Create load_data.py
Browse files- load_data.py +10 -0
load_data.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def loadFileIntoDict(file):
|
| 2 |
+
with open(file, "r") as f:
|
| 3 |
+
lines = f.readlines()
|
| 4 |
+
f.close()
|
| 5 |
+
|
| 6 |
+
D = {}
|
| 7 |
+
for index_genre_pair in lines:
|
| 8 |
+
index, genre = index_genre_pair.split(',')
|
| 9 |
+
D[int(index)] = genre[:-1]
|
| 10 |
+
return D
|