Re format a python string after splitting
<p>I have string like "week32_Aug_24_2016".
I want to change this string like "week32_2016_Aug_24"
I have tried this. </p>

<pre><code>str = "week32_Aug_24_2016"
wk = str.split('_')
newstr = wk[0]+" "+wk[3]+" "+wk[1]+" "+wk[2]
</code></pre>

<p>My expected output is "week32 2016 Aug 24".
I already got that but I want to know is there any better way to do this. Suppose I have long string and no of split value is 10, then this is very long way. So I want to know a better way to arrange the split values. Thanks.... </p>

<pre><code>&gt;&gt;&gt; import re
&gt;&gt;&gt; string = "week32_Aug_24_2016"
&gt;&gt;&gt; re.sub(r'_(.*)_(.*)_(.*)', r' \3 \1 \2', string)
'week32 2016 Aug 24'
</code></pre>

python