creating/modifying sparse files on linux

François Pinard pinard at iro.umontreal.ca
Wed Aug 17 19:48:15 EDT 2005


[draghuram at gmail.com]

> Is there any simple way of generating this 1MB string (other than keep
> appending to a string until it reaches 1MB len)?

You might of course use 'x' * 1000000 for fairly quickly generating a
single string holding one million `x'.

Yet, your idea of generating a sparse file is interesting.  I never
tried it with Python, but would not see why Python would not allow
it.  Did someone ever played with sparse files in Python?  (One problem
with sparse files is that it is next to impossible for a normal user to
create an exact copy.  There is no fast way to read read them either.)

-- 
François Pinard   http://pinard.progiciels-bpi.ca



More information about the Python-list mailing list