[Tutor] Alternative File I/O for Tuples (fwd)

Don Parris webdev at matheteuo.org
Thu Jun 30 07:23:27 CEST 2005


On Wed, 29 Jun 2005 14:09:41 -0400
Kent Johnson <kent37 at tds.net> wrote:

> Don Parris wrote:
> > ### playing with wrapfunc (all other args are the same) ###
> > wrapfunc=lambda x:wrap_onspace(str(rows), x))
> > 
> > also
> > wrapfunc=lambda x:str(wrap_onspace(rows, x)))
> 
> This is way off base. wrap_onspace takes two arguments - the string to
> wrap, and the width to wrap to. You are passing it two arguments - the
> tuple of tuples to print, and the string to wrap.
> 
> > 

Success!!!  

    mbrPhone = open('mbrPhone.txt', 'w')
    mbrPhone.write(indent(Results, hasHeader=False, separateRows=False,
    prefix='', postfix='', justify='left', wrapfunc=lambda x:str(x)))   
    mbrPhone.close()

I went back to your e-mail where you told me to use x:str(x) and re-tried
that.  I must have broken (or re-broken) something, while fixing something
else. when I tried your suggestion, it wouldn't work.  So I was trying to
fix the wrong break.  Anyway, it works beautifully- 100% accurate data:


James     | Austin    | 704-111-1234
Janet     | Austin    | 704-111-1234
James     | Austin    | 704-111-1234
Julie     | Austin    | 704-111-1234
Robert    | Bates     | 704-222-2345
Rachael   | Bates     | 704-222-2345
Bob       | Brown     | None        
David     | Carter    | 704-111-2345

That's just a sample of the complete file.

And thanks for not giving up on me!

Don
-- 
evangelinux    GNU Evangelist
http://matheteuo.org/                   http://chaddb.sourceforge.net/
"Free software is like God's love - you can share it with anyone anytime
anywhere."


More information about the Tutor mailing list