简体   繁体   中英

How to import and export data from csv file to HTML?

I want To export data from HTML to CSV file and display that data to user as well using python just like Sign up page i want to save that data in csv file.

I'm not sure if you're asking about converting a.csv to HTML table or the other way around but for either case:

Converting from HTML table to.csv

You can use beautifulsoup to parse the table.

Converting from.csv to HTML table

Pandas will do this for you:

import pandas as pd
data = pd.read_csv("foo.csv")
data.to_html("bar.html")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM