how to get partition information of a hard disk with python

Tim Golden mail at timgolden.me.uk
Fri Jul 7 03:23:43 EDT 2017


On 07/07/2017 07:18, palashkhaire92 at gmail.com wrote:
> On Wednesday, September 22, 2010 at 4:01:04 AM UTC+5:30, Hellmut Weber wrote:
>> Hi list,
>> I'm looking for a possibility to access the partiton inforamtion of a
>> hard disk of my computer from within a python program.
>>
>> Googling I found the module 'parted' but didn't see any possibility to
>> get the desired information.
>> Is there any reasonable documentation for the parted module?
>>
>> Any idea is appreciated ;-)
>>
>
>
>
> import os
> os.system("fdisk -l")
> #you will get information about your hdd,partition
>

psutil is usually good for these sort of things:

http://pythonhosted.org/psutil/#disks

TJG



More information about the Python-list mailing list