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
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
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
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
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
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