title: I would like to check if an incoming file (the imported file) is a .csv or .xls or .xlxs in python
body: <p>My problem statement is to find if the imported file is a <code>CSV</code> or <code>EXCEL</code> file in pandas. The input will be given from the command line as sys.argv[1] where sys.argv[1] is 'D:/Users/abc'</p>
  
  <p>When the path along with file name is given in command line as a parameter, I have to check inside my script if sys.argv[1] is a CSV or EXCEL file</p>
  
  <p>eg: python myscript.py D:/Users/abc [abc is the file name]</p>
  
  <p>This should say if the file is CSV or EXCEL</p>
  
  <p>I tried referring the answers from below link, but could not find exactly what I am looking for!</p>
  
  <p><a href="https://stackoverflow.com/questions/23515791/how-to-check-the-uploaded-file-is-csv-or-xls-in-python">How to check the uploaded file is csv or xls in python?</a></p>
  
  <p>Any help would be highly appreciated</p>