python - A size of a data that actually was read -
i read part of file:
size_to_read = 999999 open(file_name, "r") f: read_part = f.read(size_to_read) how know size of data (read_part) read in case if size of file less size_to_read?
simply check length of string built in len function:
size_to_read = 999999 open(file_name, "r") f: read_part = f.read(size_to_read) if(not len(read_part) == size_to_read): eol_reached_unexpectedly()
Comments
Post a Comment