format discs.
Tim Roberts
timr at probo.com
Thu Jul 10 00:05:49 EDT 2003
"Taka" <taka at net.hr> wrote:
>
>Let's presume you want to format a unix partition and that it is
>/dev/hda1.
>The do this:
>
>#!/bin/python
>
>import os
>partition = open ('/dev/hda1', 'w')
>
>for x in range(os.path.getsize('/dev/hda1'):
> partition.write ('0')
>
>partition.close()
Without commenting on the advisability or efficiency of the algorithm, it
is worth pointing out that you probably wanted a binary zero:
partition.write ('\0')
rather than an ASCII character.
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list