Looking for a function that swaps items in a list
<p>I am writing a script to swap several items in some lists read from a *.txt file, I tried to write it like this:</p>

<pre><code>i_file = map(lambda x: x.split('|'), open('test.txt', 'r').readlines())
for list in i_file:
    list = [list[2], list[0], list[3], list[1], list[4:]]
    #Actually I want to update the i_file, but I don't think this will work here
    #nevermind, it's just a demostration.
</code></pre>

<p>It looks so ugly and hard to read, so I am looking for </p>

<pre><code> somefunc()
</code></pre>

<p>that might make my code look like this.</p>

<pre><code>i_file = map(lambda x: x.split('|').somefunc(), open('test.txt', 'r').readlines())
</code></pre>

<p>Thanks!!</p>

<p>UPDATE:</p>

<p>input file looks like this:</p>

<pre><code>blahblah1|3141593|Wednesday|John|BlahBlah1|
blahblah2|2714323|Monday|Mike|BlahBlah2|
</code></pre>

<p>I want to swap these items in each line in order to rewrite the file into:</p>

<pre><code>3141593|Wednesday|blahblah1|John|BlahBlah1|
blahblah2|Monday|2714323|Mike|BlahBlah2|
</code></pre>
