On Thu, Aug 23, 2012 at 4:03 PM, David Rock <[email protected]> wrote:
> text = raw_input("Enter text: ")
> sep = 'and'
> parts = text.split(sep)
> for i in parts[:-1]:
> print i
> print sep
> print [-1]
>>> "band".split("and")
['b', '']
It needs to be sep = " and ". That's assuming we're ignoring tabs.
Line feed shouldn't be an issue since the source is raw_input.
Anything more advanced should probably use regular expressions.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor