title: How to fix "TypeError: cannot use a string pattern on a bytes-like object"?
body: <p>I am writing a simple program for linux that looks at the mac address. My program should look at "<code>ifconfig</code>" and use regular expressions to pull out only the MAC address.</p>
  
  <pre><code>import subprocess
  import re
  
  print('This program will only look at the mac address.')
  print('Enter your interface.(for example: wlan0))')
  interface = input(': ')
  find_mac = subprocess.check_output(["ifconfig", interface], shell=True)
  mac_clean = re.search(r"\w\w:\w\w:\w\w:\w\w:\w\w\:\w\w", find_mac)
  print(mac_clean.group(0))`
  </code></pre>
  
  <p>I expect the output of to be <code>MY:MAC:ADDRESS</code>, but the actual output is </p>
  
  <blockquote>
    <p>mac_clean = re.search(r"\w\w:\w\w:\w\w:\w\w:\w\w:\w\w", find_mac)<br>
    File "/usr/lib/python3.7/re.py", line 183, in search<br>
    return _compile(pattern, flags).search(string)<br>
    TypeError: cannot use a string pattern on a bytes - like object</p>
  </blockquote>