title: Finding a specific serial COM port in pySerial (Windows)
body: <p>I have a script built (Windows 7, Python 2.7) to list the serial ports but I'm looking for a device with a specific name.
  My script:</p>
  
  <pre><code>import serial.tools.list_ports
  ports = list(serial.tools.list_ports.comports())
  for p in ports:
      print(p)
  </code></pre>
  
  <p>This returns:</p>
  
  <pre><code>COM3 - Intel(R) Active Management Technology - SOL (COM3)
  COM6 - MyCDCDevice (COM6)
  COM1 - Communications Port (COM1)
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Great! However, I want this script to automatically pick out MyCDCDevice from the bunch and connect to it. 
  I tried:</p>
  
  <pre><code>import serial.tools.list_ports
  
  ports = list(serial.tools.list_ports.comports())
  for p in ports:
      if 'MyCDCDevice' in p:
          print(p)
          // do connection stuff to COM6
  </code></pre>
  
  <p>But that doesn't work. I suspect because p isn't exactly a string, but an object of some sort?</p>
  
  <p>Anyways, what's the correct way to go about this?</p>
  
  <p>Thanks!!</p>