[Tutor] small problem with lists/tuples
Thomi Richards
thomi at imail.net.nz
Mon Sep 29 05:55:45 EDT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
Here's a small problem I'm trying to nut out:
I have a function which returns some data in different forms. for example:
sometimes, it will return:
['data']
or:
[['data']]
or even:
([['data']])
what I'm trying to do, is "unpack" the duples, until i get to the actual data
inside. Originally, i thought I could do it something like this:
while 1:
if (len(data) > 1):
data = data[0]
else:
break
however, it turns out that the actual data itself could be a single character
long. I guess I could use the type() builtin function, but I thought aybe
there was a cleaner/nicer way to do this? any ideas?
Thanks,
- --
Thomi Richards,
http://once.sourceforge.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/eAGh2tSuYV7JfuERAlrgAJ4vyXpBfC9JB1Irg9oY0xsMRJJsdwCfdSzA
lqCwJ8+Puvrp9ZI6DkLAsY8=
=iZ9d
-----END PGP SIGNATURE-----
More information about the Tutor
mailing list