Python - How do you remove characters recieved as a list from an ldap query?
<p>I have performed an LDAP query looking for a list of Windows Servers, the result returned is a list. I used the filter of CN and the below is a sample from the response, I have 1000's in the raw file.</p>

<pre><code>('CN=SERVER1,OU=General Servers,OU=Servers,OU=Computers,OU=Group,DC=Domain,DC=com', {}),
('CN=SERVER2,OU=General Servers,OU=Servers,OU=Computers,OU=Group,DC=Domain,DC=com', {})
</code></pre>

<p>I only need the name, in this sample that would be 'SERVER1' or 'SERVER2'</p>

<p>What is the best way to split this list, removing 'CN=' and everything after and including the ','</p>

<p>If someone is aware of a better ldap query than</p>

<pre><code>(r"(&amp;(objectclass=computer)(objectcategory=computer)(operatingSystem=Windows*Server*)(cn=*))")
</code></pre>

<p>Using a different filter than,CN or sAMAccountName that returns just the host names, that would be a useful to know as a viable workaround.</p>