[python] Splitting strings using a delimiter in python

OK so I have a string that has this:

Dan|warrior|54

I'm trying to make so I can use python and split it using | as the delimiter. Here's what I have so far:

#!/usr/bin/env python
dan = 'dan|warrior|54'
print dan.split('|')

and that results into this:

['dan', 'warrior', '54']

I know it's incomplete but what do I have to do to finish it? Yes, I tried googling this problem... but it's not happening. :(

I want so that I can choose specifically which one from the delimiter so if I was dan.split('|')[1] .. it would pick warrior. See my point?

This question is related to python

The answer is


So, your input is 'dan|warrior|54' and you want "warrior". You do this like so:

>>> dan = 'dan|warrior|54'
>>> dan.split('|')[1]
"warrior"