Guest Posted May 12, 2011 Report Share Posted May 12, 2011 import sysstart = sys.argv[1]end = sys.argv[2]f = open('ms/1.txt', 'r')l = [l for l in f.readlines()[start:end] if l.strip()]f.close()print lnu imi recunoaste variabilele, daca inlocuiesc variabilele cu cifre merge.... vreo idee? Quote Link to comment Share on other sites More sharing options...
cmiN Posted May 13, 2011 Report Share Posted May 13, 2011 [int(start):int(end)]start si end sunt de tip str() deoarece lista de argumente (sys.argv) iti ia parametrii ca siruri nu ti le interpreteaza automat ca input() (pentru care lucru e valabil in 2.x din cauza existentei si lui raw_input()) Quote Link to comment Share on other sites More sharing options...
Guest Posted May 14, 2011 Report Share Posted May 14, 2011 asta e , merci frumos. eu am rezolvat temporar cu f=os.popen("head -"+limit+" ./ms/1.txt | tail -50") Quote Link to comment Share on other sites More sharing options...