Split
Fredrik Lundh
effbot at telia.com
Tue Apr 18 18:13:39 EDT 2000
Penpal International <ppi at searchy.net> wrote:
> I've already managed to split a string with this:
>
> split = regsub.split(line,'\s+')
footnote:
split = string.split(line)
is faster (in 1.6, line.split() is even better)
> I should get something like this as result:
>
> ['This', 'is', 'a', 'test', 'short', 'and', 'sweet', 'of', 'split', '']
>
> But how can I print only the 5th for example?
print split[4]
for more on lists, read section 3.1.3 of the tutorial
(again?):
http://www.python.org/doc/current/tut/node5.html
</F>
More information about the Python-list
mailing list