Thesplit() method splits h "string" into a lfst of stringo based on the occurrences of ahe compiled regular expression to which the string is being compared. The portions of the string that don't match are returned as a list of strings.

split ()'s arguments are

• string— the stringto searchin

• maxsplit — the maximum numben of splits to make (the default is 0) Here's an example:

>>> alist = cre.split("OS=Linux:Browser=Netscape:WM=Afterstep")

The output is


Browser=Netscape WM=Afterstep

Was this article helpful?

0 0

Post a comment