Skip to content

Instantly share code, notes, and snippets.

@robsmith1776
Created June 15, 2016 02:59
Show Gist options
  • Save robsmith1776/252d2a27d2e2fa825e2bb988299921d7 to your computer and use it in GitHub Desktop.
Save robsmith1776/252d2a27d2e2fa825e2bb988299921d7 to your computer and use it in GitHub Desktop.
def detectDelimiter(csvFile):
with open(csvFile, 'r') as myCsvfile:
header=myCsvfile.readline()
if header.find(";")!=-1:
return ";"
if header.find(",")!=-1:
return ","
#default delimiter (MS Office export)
return ";"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment