If my variable is:
string = "first second"
How can I change that to print:
second first
annoyingly simple but I can't find a solution for it!
If my variable is:
string = "first second"
How can I change that to print:
second first
annoyingly simple but I can't find a solution for it!
I'd split the string on ' '
and then join it back:
s = 'first second'
tmp = s.split(' ')
result = ' '.join((tmp[1], tmp[0]))