"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> My goal is very simple. Have a mechanism to create sparse files and
> modify them by writing arbitratry ranges of bytes at arbitrary offsets.
> I did get the information I want (xrange instead of range, and a simple
> way to generate 1Mb string in
My goal is very simple. Have a mechanism to create sparse files and
modify them by writing arbitratry ranges of bytes at arbitrary offsets.
I did get the information I want (xrange instead of range, and a simple
way to generate 1Mb string in memory). Thanks for pointing out about
using "len" as va
Terry Reedy wrote:
> megastring = 100*'a' # t < 1 sec on my machine
>>(other than keep appending to a string until it reaches 1MB len)?
>
> You mean like (unexecuted)
> s = ''
> for i in xrange(100): s += 'a' #?
>
> This will allocate, copy, and deallocate 100 successively longer
>
On 17 Aug 2005 11:53:39 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>Hi,
>
>Is there any special support for sparse file handling in python? My
>initial search didn't bring up much (not a thorough search). I wrote
>the following pice of code:
>
>options.size = 6442450944
>options.range
[EMAIL PROTECTED]
> 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' * 100 for fairly quickly generating a
single string holding one million `x'.
Yet, your idea of generating a sparse file is
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Thanks for the info on xrange. Writing single char is just to get going
> quickly. I knew that I would have to improve on that. I would like to
> write chunks of 1MB which would require that I have 1MB string to
> write. Is there any
Thanks for the info on xrange. Writing single char is just to get going
quickly. I knew that I would have to improve on that. I would like to
write chunks of 1MB which would require that I have 1MB string to
write. Is there any simple way of generating this 1MB string (other
than keep appending to
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there any special support for sparse file handling in python?
Since I have not heard of such in several years, I suspect not. CPython,
normally compiled, uses the standard C stdio lib. If your system+C has a
sparseIO lib, you w
In <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> options.size = 6442450944
> options.ranges = ["4096,1024","3,314572800"]
> fd = open("testfile", "w")
> fd.seek(options.size-1)
> fd.write("a")
> for drange in options.ranges:
> off = int(drange.split(",")[0])
> len = int(drange.split(
[EMAIL PROTECTED] wrote]
>
> Hi,
>
> Is there any special support for sparse file handling in python? My
> initial search didn't bring up much (not a thorough search). I wrote
> the following pice of code:
>
> options.size = 6442450944
> options.ranges = ["4096,1024","3,314572800"]
> fd = op
10 matches
Mail list logo