when I do curl to a API call link http://example.com/passkey=wedsmdjsjmdd
curl 'http://example.com/passkey=wedsmdjsjmdd'
I get the employee output data on a csv file format, like:
"Steve","421","0","421","2","","","","","","","","","421","0","421","2"
how can parse through this using python.
I tried:
import csv cr = csv.reader(open('http://example.com/passkey=wedsmdjsjmdd',"rb")) for row in cr: print row
but it didn't work and I got an error
http://example.com/passkey=wedsmdjsjmdd No such file or directory:
Thanks!
Use the pandas. read_csv() Function to Download a CSV File From a URL in Python. The read_csv() function from the Pandas module can read CSV files from different sources and store the result in a Pandas DataFrame.
Expor websites to CSV There is no simple solution to export a website to a CSV file. The only way to achieve this is by using a web scraping setup and some automation. A web crawling setup will have to be programmed to visit the source websites, fetch the required data from the sites and save it to a dump file.
Using pandas it is very simple to read a csv file directly from a url
import pandas as pd data = pd.read_csv('https://example.com/passkey=wedsmdjsjmdd')
This will read your data in tabular format, which will be very easy to process
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With