title: Automatically Detect ODBC Driver using Pyodbc in Python 3
body: <p>Hi I'm currently using pyodbc in Python 3 and I'm trying to figure out a way to automatically detect ODBC Driver by not having to change manually when used by different computers. The reason is because my computer has ODBC Driver 13 and another friend's computer has ODBC Driver 11 so whenever we run the script from our side, we have to manually change the version first in order to execute the process.</p>
  
  <p>Can anyone help to solve this problem? Below is my sample code.</p>
  
  <p>Thank you</p>
  
  <pre><code>import os
  import csv
  import pyodbc
  import datetime
  from dateutil.relativedelta import relativedelta
  
  
  conn = pyodbc.connect(
      r'DRIVER={ODBC Driver 13 for SQL Server};'
      r'SERVER=****;'
      r'DATABASE=****;'
      r'Trusted_Connection=yes;'
      )
  
  cursor = conn.cursor()
  
  cursor.execute("Select * From Table1")
  dData = cursor.fetchall()
  </code></pre>