You are almost there, you need to indent properly to keep your statement blocks together ...
def load_products(filename):
#filename = 'C:\Users\User\Desktop\cssetute\products.txt'
f = open(filename, 'r')
dictionary = {}
for line in f.readlines():
list1 = line.strip().split(',')
tuple_list = []
for item in list1:
line = line.rstrip()
if ':' in item:
text, num = item.split(":")
tuple_list.append((text, int(num)))
# build the dictionary
dictionary[list1[0]] = (list1[1], tuple_list)
f.close()
return dictionary
my_dict = load_products('products.txt')
print(my_dict)
"""my output (made somewhat pretty) -->
{'toy301': (' Flying Kite',
[(' AB339', 2), ('DC302', 2), ('FR377', 2), ('JK301', 1),
('YU301', 1), ('EE301', 1), ('FW301', 1)]),
'toy201': (' Racing Car',
[(' AB239', 2), ('DC202', 2), ('FR277', 2),
('JK201', 1), ('YU201', 1), ('EE201', 1), ('FW201', 1)]),
'toy101': (' Barbie Doll',
[(' AB139', 2), ('DC102', 2), ('FR177', 2),
('JK101', 1), ('YU101', 1), ('EE101', 1), ('FW101', 1)])}
"""