import csv, re, sqlite3 import sys op = '' if(int(sys.argv[1]) == 1): op = 'WS' elif(int(sys.argv[1]) == 2): op = 'WR' elif(int(sys.argv[1]) == 3): op = 'SR' con = sqlite3.connect("database_modfire.db") cur = con.cursor() Filemame = "Paredes"+op+"/outputPairsMultiParedes"+op+".csv" f=open(Filemame,"r") lines=f.readlines() result=[] x = [] y = [] i = 1 o = 0 printNext = True print("Pick solution") isFirst = True divisible = 0 for line in lines: if(isFirst): isFirst = False elif(line[0] == "P"): break divisible = divisible + 1 for line in lines: if(printNext): print(line[:-1]) printNext = False else: if(i % divisible == 0): printNext = True i+=1 val = input("Pick solution: ") goTo = int(val)*divisible+1 until = (int(val)+1)*divisible import itertools years = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] soilByYear = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] toWrite = '' fs=open("Paredes"+op+"/pickedSol","w+") with open(Filemame, "r") as text_file: for line in itertools.islice(text_file, goTo, until): #print(line[:-1]) fs.write(line) fs.close() fs=open("Paredes"+op+"/"+val,"w+") fs.close()