File tests in Python
Joakim Hove
hove at phys.ntnu.no
Fri Oct 13 14:12:54 EDT 2000
Following up on my own post:
> [...] Writing
>
> List = [1,2,["List","in","List"]]
>
> in Python is just the way it _should_ be, really nice!
In this case List[0] and List[1] are simple scalars - whearas List[2]
is a new list (or is this a "unPythonlike" way of thinking ??). Is
there a way of testing this, i.e.
for x in range(len(List)):
if is_scalar L[x]:
print "List[",x,"] is scalar"
else
print "List[",x,"] is not scalar - maybe a list?"
Joakim Hove
--
=== Joakim Hove www.phys.ntnu.no/~hove/ ======================
# Institutt for fysikk (735) 93637 / E3-166 | Skøyensgate 10D #
# N - 7491 Trondheim hove at phys.ntnu.no | N - 7030 Trondheim #
================================================ 73 93 31 68 ========
More information about the Python-list
mailing list