sudhir prasad wrote:
hi,
what is the equivalent function to strtok() in c++,
what i need to do is to divide a line into different strings and store them
in different lists,and write them in to another file
If your tokens are separated by whitespace, you can simply use a single
call to split(). It will turn a single string into a list of tokens.
line = "Now is the time"
print line.split()
will display the list:
['Now', 'is', 'the', 'time']
HTH
DaveA
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor