Size in byte of a string ?

Shagshag13 shagshag13 at yahoo.fr
Mon Jul 29 07:15:23 EDT 2002


"Shagshag13" <shagshag13 at yahoo.fr> a écrit dans le message de news: ai37ij$10tmvq$1 at ID-146704.news.dfncis.de...
> [sorry for the previous incomplete post]
>
> hello,
>
> i had the following problem : i had huge files > 1,5 go. each of theses files contain some other small files and they are separate
> by a header. i need to do some kind of random access to the small files so i wish to write a script which would build some kind of
a
> table of content for theses huges files.
>
> i would like to have something like
> samllfile_header_name_i : start_at_byte : end_at_byte
>
> and i will do :
> f.seek(start_at_byte)
> samllfile_header_name_content = f.read(end_at_byte)
>
> but to do this i need to be able at the building time to know how much bytes take a string ?
>
> (i think there is something with the size in byte of CR/LF but how to measure it ? i hope i won't have to do some
> start_at_line, end_at_line as it will need to always read file from start...).

i forget to write that theses are text files, that what i call "header" is more some kind of separator ("name_of_the_file\n").

thanks in advance,

s13.





More information about the Python-list mailing list