Is there a Python module that already does this?
Emile van Sebille
emile at fenx.com
Wed Feb 6 11:53:54 EST 2002
More information about the Python-list mailing list
Wed Feb 6 11:53:54 EST 2002
- Previous message (by thread): Is there a Python module that already does this?
- Next message (by thread): Is there a Python module that already does this?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"MDK" <mdk at mdk.com> wrote in message news:a3rbad$19u08k$1 at ID-98166.news.dfncis.de... > I need to convert a list into a list of characters. > > For example: > > ("cat",5,['dog',[3,3,1]],"zoo") > > Would become: > > ('c','a','t',5,'d','o','g',3,3,1,'z','o','o') > def flatten(ary, rslt): try: flatten(ary[0], rslt) flatten(ary[1:], rslt) except: if ary: rslt.append(ary) rslt = [] flatten(("cat",5,['dog',[3,3,1]],"zoo"), rslt) print 'rslt = ',tuple(rslt) HTH, -- Emile van Sebille emile at fenx.com ---------
- Previous message (by thread): Is there a Python module that already does this?
- Next message (by thread): Is there a Python module that already does this?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list