CSV (Comma-Separated Values): A CSV file is a delimited text file that uses a comma to separate values.
Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format. A CSV file typically stores tabular data (numbers and text) in plain text, in which case each line will have the same number of fields.
import csv
JSON (Javascript Object Notation): JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute-value pairs and arrays (or other serializable values). JSON files are commonly used for web APIs and configuration files, and can be easily handled using Python's built-in json module.
import json
XML (Extensible Markup Language): XML is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. XML files are commonly used for web services and data exchange between different applications.
import xml.etree.ElementTree as ET
tree = ET.parse('data.xml')
root = tree.getroot()
for person in root.findall("person"):
name = person.find("name").text
Excel: This is a popular spreadsheet application that is widely used in business and finance.
import pandas
SQL (Structured Query Language): This is a standard language for managing relational databases, and is widely used in data management and analysis.
Python provides several libraries for working with SQL databases, such as sqlite3, MySQLdb, and psycopg2.
网友评论