split

Joachim Bauch jojo at struktur.de
Fri Jun 11 07:51:25 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gandalf wrote:
|
| This way:
|
|  >>> s = 'some string'
|  >>> l = []
|  >>> for c in s:
| ...     l.append(c)
| ...
|  >>> l
| ['s', 'o', 'm', 'e', ' ', 's', 't', 'r', 'i', 'n', 'g']
|  >>>

an even faster way would be

|>> s = 'another string'
|>> l = [ch for ch in s]
|>> l
['a', 'n', 'o', 't', 'h', 'e', 'r', ' ', 's', 't', 'r', 'i', 'n', 'g']

Joachim

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAyZy9vb5cTc087cURAnUDAJ46B7Gikydj3yG2R9nK46M5/S4SngCfT0Fk
ENK4radRa34QXpF4Gi1GROo=
=LB+K
-----END PGP SIGNATURE-----




More information about the Python-list mailing list