I'm using Jinja2 template engine (+pelican).
I have a string saying "a 1", and I am looking for a way to split that string in two by using the white-space as the delimiter.
So the end result I'm looking for is a variable which holds the two values in a form of an array. e.g. str[0] evaluates to "a" & str[1] evaluates to "1".
Thanks in advance.
Calling split on the string should do the trick:
"a 1".split()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With