File and Data Manipulation
CSV File/Data
Sample CSV File: link.txt
Name,URL
Cisco,http://cisco.com
Facebook,http://facebook.comRead file using csv reader
import csv
file = open(“link.txt”,”rt”)
reader = csv.reader(file)
#Next(reader) # this is equal to if rownum!=0 below
rownum = 0
for row in reader:
# Save header row.
if rownum !=0:
print (“{0}: {1}”.format(row[0], row[1]))
rownum+=1
file.close()Another example for reading csv file:
Read file using csv DictReader
Write file using CSV Reader
PDF Files
Installation
Pymupdf: pip3 install pymupdf
PDFMinder: pip3 install pdfminer
Usage of pymupdf
Usage of pdfminer
JSON Data
Save to file
Read from file
Print to stdout
Read JSON Data from String
INI File
Read config file
Reference
Last updated