Month: November 2018

Python Files

Use the open() method to access the contents of a file. example: FH = open(“filename”, “mode”) –> returns a file object that can be used to manipulate the file’s content. More efficient way: with open(“filename”, “mode”) as FH: –> returns

Python files (CSV data)

Libraries: CSV and JSON CSV Methods: reader() –> returns a reader object. Each row read from the csv file is returned as a list of strings. No automatic data type conversion is performed. DictReader() –> returns a writer object responsible

Top