Python 3.0 help - SOLVED

JTsyo

Lifer
Nov 18, 2007
12,034
1,133
126
I had a program that I had written a while to manipulate text files. It seems moving to Python 3.0 has changed some of the syntax. I imported the string and sys modules.

Previously I had j=string.replace(i,',',' ') which replaced , with space. After looking over the docs it seems now it should be j=i.replace(',',' '). When trying to run it with IDLE I get the error AttributeError: 'module' object has no attribute 'replace'.

Any ideas?

FYI the loop that's giving me the trouble now
Code:
   for i in data:
      #print i
      j = i.replace(',','  ')
      a = i.split(j)
      #print a

      time+=t
      newdatax.append((time,a[0]))
      newdatay.append((time,a[1]))
      newdataz.append((time,a[2]))
 
Last edited:

JTsyo

Lifer
Nov 18, 2007
12,034
1,133
126
Not sure what I did but it got fixed. One error I did catch though was that a=i.split(j) should be a=j.split()