[Tutor] Writing a txt from dbf

Susana Iraiis Delgado Rodriguez susana.delgado_s at utzmg.edu.mx
Tue Sep 28 20:33:51 CEST 2010


Hello dear pythonists:

I'm developing an application in python, I'm new using this programming
language I used to work with Java, but in my job my superiors suggested me
to develop in this language.
I'm trying to read a dbf file, I already done it but my code shows me all
the lines without spaces, I want it toshow line per line and then write the
lines into a plain txt file. My code is:

from dbf import *
from string import strip
import sys
def demo1():
 a = open ("archivo.txt","w")
 dbf = Dbf('tapalpa_05_plani_point.dbf',new=False)

 for k in dbf:
  print '%s'%(strip(k[2]))

  l=()
  l=(strip(k[2]))
  a.write(l)

 dbf.close()
 a.close()


demo1()
I hope you can help me.
Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100928/9db29c58/attachment.html>


More information about the Tutor mailing list