Horje
python quickly goto line in file Code Example
python quickly goto line in file
# Read in the file once and build a list of line offsets
line_offset = []
offset = 0
for line in file:
    line_offset.append(offset)
    offset += len(line)
file.seek(0)

# Now, to skip to line n (with the first line being line 0), just do
file.seek(line_offset[n])




Python

Related
how to make a new column with explode pyspark Code Example how to make a new column with explode pyspark Code Example
pyspark dataframe to single csv Code Example pyspark dataframe to single csv Code Example
python list to bytes Code Example python list to bytes Code Example
python string: immutable string Code Example python string: immutable string Code Example
instal django impoer expor Code Example instal django impoer expor Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8