readline() method wasn't call on file object

This commit is contained in:
JLo'w 2016-02-11 19:50:19 +01:00
parent 192f6fad2e
commit 93881fd341

32
read.py
View file

@ -1,11 +1,9 @@
#Read the input file #Read the input file
import sys.io
def Read_input_file(file): def Read_input_file(file):
f = open(file, 'r') f = open(file, 'r')
line = readline() line = f.readline()
info = line.split(' ') info = line.split(' ')
GRILLE = (int(info[0]), int(info[1])) GRILLE = (int(info[0]), int(info[1]))
@ -13,41 +11,41 @@ def Read_input_file(file):
T = int(info[3]) T = int(info[3])
M = int(info[4]) M = int(info[4])
line = readline() line = f.readline()
P = int(line) P = int(line)
line = readline() line = f.readline()
info = line.split(' ') info = line.split(' ')
for (i in range(0, P)): for i in range(0, P):
Pw[i] = int(info[i]) Pw[i] = int(info[i])
line = readline() line = f.readline()
W = int(line) W = int(line)
for (i in range(0, W)): for i in range(0, W):
line = readline() line = f.readline()
info = line.split(' ') info = line.split(' ')
Wp[i] = (int(info[0]), int(info[1])) Wp[i] = (int(info[0]), int(info[1]))
line = readline() line = f.readline()
info = line.split(' ') info = line.split(' ')
productQ = {} productQ = {}
for (j in range(1, info.size()+1): for j in range(1, info.size())+1:
productQ[j] = int(info[j]) productQ[j] = int(info[j])
Wi[i] = productsQ Wi[i] = productsQ
line = readline() line = f.readline()
nbC = int(line) nbC = int(line)
for(i in range(0, nbC)): for i in range(0, nbC):
line = readline() line = f.readline()
info = line.split(' ') info = line.split(' ')
Cp[i] = (int(info[0]), int(info[1])) Cp[i] = (int(info[0]), int(info[1]))
line = readline() line = f.readline()
nbP = int(line) nbP = int(line)
line = readline() line = f.readline()
info = line.split(' ') info = line.split(' ')
orderQ = {} orderQ = {}
for (j in range(0, nbP)): for j in range(0, nbP):
orderQ[j] = int(info[j]) orderQ[j] = int(info[j])
Ci[i] = orderQ Ci[i] = orderQ