# simple_reader : a program to read in a data file and get # some info from it # a hashtag (#) tells both python and Gurobi that you are making a comment # ######################################################## # setting some constants n = 5 # there are 5 project groups d = 4 # each group specifies its preferences of days, e.g., 3241 input_data = "data5x4.txt" # this is the name of the file # ######################################################## # ######################################################## # Main program: # ######################################################## inp = open(input_data,"r") # we open the data file and call it "inp" for i in range(n): # this means for i = 0,1,2,3,...,n-1 inp_line = inp.readline() # read one line of inp, call it inp_line # just for diagnostics print("I just read the line: " + inp_line) # parts_of_line = inp_line.split(",") # this splits the input by , print("Name of project: " + parts_of_line[0]) prefs = parts_of_line[1] for j in range(d): print("Choice " +str(j+1)+ ": " + prefs[j] ) print("\n\n") inp.close() # we close file that we opened