How can I get parts of a string separated by columns

Viewed 44

What I need to separate is a string that has been divided by columns.

For example the string:

my_string = "username:id:token"

How would I go about trying to get the username, id and token into separate variables?

1 Answers

Just do this

username, ID, token = my_string.split(':')
Related