Lambda function Python3 no change in output
<pre><code>def salary_sort(thing):
    def importantparts(thing):
        for i in range(1, len(thing)):
            a=thing[i].split(':')
            output = (a[1],a[0],a[8])
            sortedlist = sorted(output, key = lambda item: item[2], reverse=True)
            print(sortedlist)
    return importantparts(thing)

salary_sort(employee_data)
</code></pre>

<p>This function is supposed to sort out a list of names by their salary. 
I managed to isolate the first last names and salaries but I can't seem to get it to sort by their salaries </p>

<p>'Thing' aka employee_data</p>

<pre><code>employee_data = ["FName  LName   Tel      Address  City   State  Zip   Birthdate   Salary",
"Arthur:Putie:923-835-8745:23 Wimp Lane:Kensington:DL:38758:8/31/1969:126000",
"Barbara:Kertz:385-573-8326:832 Ponce  Drive:Gary:IN:83756:12/1/1946:268500",
"Betty:Boop:245-836-8357:635 Cutesy Lane:Hollywood:CA:91464:6/23/1923:14500",.... etc.]
</code></pre>

<p>Output</p>

<pre><code>['Putie', 'Arthur', '126000']
['Kertz', 'Barbara', '268500']
['Betty', 'Boop', '14500']
['Hardy', 'Ephram', '56700']
['Fardbarkle', 'Fred', '780900']
['Igor', 'Chevsky', '23400']
['James', 'Ikeda', '45000']
['Cowan', 'Jennifer', '58900']
['Jesse', 'Neal', '500']
['Jon', 'DeLoach', '85100']
['Jose', 'Santiago', '95600']
['Karen', 'Evich', '58200']
['Lesley', 'Kirstin', '52600']
['Gortz', 'Lori', '35200']
['Corder', 'Norma', '245700']
</code></pre>

<p>There are a number of issues with your code, but the key one is that you are sorting <em>each row</em> as you create it, rather than the list of lists.</p>

<p>Also:</p>

<ul>
<li><p><code>importantparts()</code> doesn't return anything (so <code>salarysort()</code> returns None).  </p></li>
<li><p>You need to cast the <code>Salary</code> field to an <code>int</code> so that it sorts properly by value (they don't all have the same field-width, so an alphanumeric sort will be incorrect).</p></li>
<li><p>Finally, you don't need to use <code>for i in range(1, len(thing)):</code>, you can iterate directly over <code>thing</code>, taking a <a href="http://stackoverflow.com/questions/509211/explain-pythons-slice-notation">slice</a> to remove the first element<sup>1</sup>. </p></li>
</ul>

<p><sup>1</sup><sub>Note that this last is not <em>wrong</em> per se, but iterating directly over an iterable is considered more 'Pythonic'.</sub></p>

<p></p>

<pre><code>def salary_sort(thing):
    def importantparts(thing):
        unsortedlist = []
        for item in thing[1:]:
            a=item.split(':')
            unsortedlist.append([a[1],a[0],int(a[8])])
        print unsortedlist
        sortedlist = sorted(unsortedlist, key = lambda item: item[2], reverse=True)
        return (sortedlist)
    return importantparts(thing)

employee_data = ["FName  LName   Tel      Address  City   State  Zip   Birthdate   Salary",
                 "Arthur:Putie:923-835-8745:23 Wimp Lane:Kensington:DL:38758:8/31/1969:126000",
                 "Barbara:Kertz:385-573-8326:832 Ponce  Drive:Gary:IN:83756:12/1/1946:268500",
                 "Betty:Boop:245-836-8357:635 Cutesy Lane:Hollywood:CA:91464:6/23/1923:14500"]


print salary_sort(employee_data)
</code></pre>

<p>Output:</p>

<pre><code>[['Kertz', 'Barbara', 268500], ['Putie', 'Arthur', 126000], ['Boop', 'Betty', 14500]]
</code></pre>

python sorting lambda