[Tutor] Fwd: Writing a txt from dbf

Joel Goldstick joel.goldstick at gmail.com
Tue Sep 28 21:37:44 CEST 2010


On Tue, Sep 28, 2010 at 2:33 PM, Susana Iraiis Delgado Rodriguez
<susana.delgado_s at utzmg.edu.mx> wrote:
> 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!
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>

I was going to run your code, but I am not sure what dbf module you
are using.  I am running UBUNTU 9.10 and can't find a dbf module in
the repository.

What are you running?

--
Joel Goldstick



-- 
Joel Goldstick


More information about the Tutor mailing list