Python: How do i manipulate the list to get the string starting with '+'?
<p><br>
I am comparing 2 txt files that are <code>ls -R</code> of the etc directory in a linux system. I compared the 2 files using <code>difflib.differ</code> and got this list as my result (i put the dots to keep the list short in here):</p>

<pre><code>result = [' etc:\n', ' ArchiveSEL\n', ' HOSTNAME\n', ' RMCPUser\n', ...,
    ' qcleaner\n', '+ extraFile\n', ' rc.d\n', '+ extraFile2\n', ...,
    ' resolv.conf\n', ' wu-ftpd\n']
</code></pre>

<p>I want to be able to take the strings with the <code>'+'</code> sign out to do something else. how do i manipulate the list? in the example above, i want to be able to get this string <code>"extraFile"</code> and <code>"extraFile2"</code>.</p>

<p>Thanks to all the people who posted solutions. It helps a lot and I am grateful :)</p>

<p>Here's what I did to get the string I wanted:  </p>

<p>newresult = [file[2:-1] for file in result if file.startswith('+')]  </p>

<p>to print out the strings:  </p>

<p>for i in range (len(newresult)):<br>
    print newresult[i]</p>

<p>THANKS~!!! :)</p>
