Skip to content

Instantly share code, notes, and snippets.

Doing heavy math

Stephen B drsxr

Doing heavy math
View GitHub Profile
drsxr /
Created July 19, 2022 22:28
Get last line of file (csv) without reading the entire file into memory
#This works. Yields the last line of the file as a string without reading the entire file into memory.
#Use a parsing function to separate returned data by commas to select the desired element.
import os
def get_last_line_records_of_file(identifier_data):
filepath = linux_path+"/"+identifier_data+".csv"
with open(filepath,'rb') as f:,os.SEEK_END)