Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread Marc 'BlackJack' Rintsch
On Fri, 29 Aug 2008 09:40:32 -0700, W. eWatson wrote: > Actually, I'm getting the file names from listdir, and they appear to be > sorted low to high. I tried it on a folder with lots of dissimilar > files. But that's not guaranteed. It depends on the operating system and file system driver if

Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread George Sakkis
On Aug 29, 1:29 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > It looks like I have a few new features to learn about in Python. In > particular, > dictionaries. In Python it's hard to think of many non-trivial problems that you *don't* have to know about dictionaries. George -- http://mail.pyth

Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread W. eWatson
castironpi wrote: ... I don't think that's guaranteed by anything. I realized that 'dat.sort()' and 'txt.sort()' weren't necessary, since their contents are moved to a dictionary, which isn't sorted. Actually, I'm getting the file names from listdir, and they appear to be sorted low to high.

Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread Boris Borcic
D,T=[dict((x.split('.')[0],x) for x in X) for X in (dat,txt)] for k in sorted(set(D).union(T)) : for S in D,T : print '%-8s' % S.get(k,'None'), print HTH W. eWatson wrote: Maybe there's some function like zip or map that does this. If not, it's probably fairly easy to do with pu

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread Paul Rubin
"W. eWatson" <[EMAIL PROTECTED]> writes: > [a.dat, c.dat, g.dat, k.dat, p.dat] > [a.txt, b.txt, g.txt, k.txt r.txt, w.txt] > > What I need is to pair up items with the same prefix and use "None", > or some marker, to indicate the absence of the opposite item. This is functionally influenced but

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread castironpi
On Aug 29, 12:29 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > castironpi wrote: > > > This gets you your list.  What do you mean by 'missing member of > > (a.dat, a.txt) is a pair. (None, a.txt) has a.dat missing. I just need to > issue a msg to the user that one member of a file pair is missing.

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread W. eWatson
castironpi wrote: On Aug 28, 10:50 pm, "W. eWatson" <[EMAIL PROTECTED]> wrote: Maybe there's some function like zip or map that does this. If not, it's probably fairly easy to do with push and pop. I'm just checking to see if there's not some known simple single function that does what I want. H

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread castironpi
On Aug 28, 10:50 pm, "W. eWatson" <[EMAIL PROTECTED]> wrote: > Maybe there's some function like zip or map that does this. If not, it's > probably fairly easy to do with push and pop. I'm just checking to see if > there's not some known simple single function that does what I want. Here's > what I'

Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread W. eWatson
Maybe there's some function like zip or map that does this. If not, it's probably fairly easy to do with push and pop. I'm just checking to see if there's not some known simple single function that does what I want. Here's what I'm trying to do. I have a list dat like (assume the items are str