need help using enumerate ??

Eric_Dexter at msn.com Eric_Dexter at msn.com
Fri Aug 22 07:14:52 EDT 2008


I am trying to take some data in   file that looks like this

command colnum_1 columnum_2

and look for the command and then cange the value in the collum(word)
number indicated.  I am under
the impression I need enumerate but I am not sure what to do with it
any help would be nice.

import sys

parse1filerows = []
csoundrows = []

filename = sys.argv[0]
number = sys.argv[1]
outfile = open('test.sco','w')

infile = open(filename, 'r')
for line in infile:
  csoundrows.append(line.split())
parsefile = open('parsefile1.txt', 'r')
for line in parsefile:
  parsefile1rows.append(line.split())
for row in csoundrows:
  for prow in parsefile1rows:
    test = 0
    if parsefile1[prow][0] in csoundrow[row]:
      for pcol in parsefile1[prow]:
        if test == 1:
          csoundrows[row][int(pcol)] = str(int(csoundrows[row]
[int(pcol)] + number)
for row in csoundrows:
  for word in rows:
    outfile.write(row)



More information about the Python-list mailing list