format discs.
Gerhard Häring
gh at ghaering.de
Wed Jul 9 09:00:33 EDT 2003
Taka wrote:
> On Wed, 09 Jul 2003 06:26:38 +0000, Flanagan wrote:
>>hello to all
>>
>>somebody can say to me whereupon I modulate of python I can format
>>discs.
>>
>>
>>thanks flanagan
>
> 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()
>
>
> :)
Didn't you mean ;-) instead of :) ?
Your approach is hard to beat in inefficiency.
-- Gerhard
More information about the Python-list
mailing list