Re: [Tutor] python 3.3 split method confusion

2014-01-08 Thread Peter Otten
Danny Yoo wrote: > One of the common cases for split() is to break a line into a list of > words, for example. > > # 'hello this is a test'.split() > ['hello', 'this', 'is', 'a', 'test'] > # > > The Standard Library can

Re: [Tutor] python 3.3 split method confusion

2014-01-07 Thread Christian Alexander
That makes total sense now. I was just curious as to why it didn't output the arbitrary delimiter in the list, or if there was a specific reason for it. On Sat, Jan 4, 2014 at 10:03 PM, Danny Yoo wrote: > One of the common cases for split() is to break a line into a list of > words, for examp

Re: [Tutor] python 3.3 split method confusion

2014-01-04 Thread Danny Yoo
One of the common cases for split() is to break a line into a list of words, for example. # >>> 'hello this is a test'.split() ['hello', 'this', 'is', 'a', 'test'] # The Standard Library can not do everything that we can conc

Re: [Tutor] python 3.3 split method confusion

2014-01-04 Thread Christian Alexander
Thank you for clarifying my inquiry. I was just unable to find the reason as to why the built-in excludes the delimiter from the outpu. On Sat, Jan 4, 2014 at 9:25 AM, Alan Gauld wrote: > On 04/01/14 14:10, Christian Alexander wrote: > > I am curious to know why the split() method does not out

Re: [Tutor] python 3.3 split method confusion

2014-01-04 Thread Alan Gauld
On 04/01/14 14:10, Christian Alexander wrote: I am curious to know why the split() method does not output the arbitrary delimiter that is passed as an argument? For example: Because in most cases you don't want it and would have to strip it off each element manually after the event. I suppos

[Tutor] python 3.3 split method confusion

2014-01-04 Thread Christian Alexander
Hello fellow tutors, I am curious to know why the split() method does not output the arbitrary delimiter that is passed as an argument? For example: string1 = "this,is,just,another,string" print(string1.split(",")) I understand the the above code simply states, "break at every ' , ' ". But why