473,394 Members | 1,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

List of avaliable Partitions

Hey all!

Another fast question!

How can I get a list of all available hard disk partitions on the current computer!

I managed to work out one my self but it works only with Windows! Any one knows a Cross-platform way? I want it to work on my linux!

Dec 21 '07 #1
1 1555
on linux it would be easier to use the shell and do something like:

Expand|Select|Wrap|Line Numbers
  1. cat /proc/partitions
this would be one way to make your program more portable:
Expand|Select|Wrap|Line Numbers
  1. from sys import platform
  2. from os import system
  4. if 'linux' in platform:
  5.     system('cat /proc/partitions')
  6. else: 
  7.     #your windows version of the program would go here
or instead of using sys.platform you could use sys.version to distinguish between various linux distros.
Dec 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Elaine Jackson | last post by:
List comprehensions don't work the way you intuitively expect them to work. I realize many people have no intuitions about how list comprehensions 'should' work, so if you recognize yourself in...
by: Heiko Wundram | last post by:
Hi all, esp. list admins! Why is it that I always get bounces saying my mails have suspicious headers lately when I post to python-list? This only happens when I reply to myself (as I just did,...
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of...
by: cantabile | last post by:
Hi, I'd like to get drives and partitions (and their size too) with python under Linux. So far, I thought of reading /proc/partitions but maybe i could use fdsik also ? How would I do that in...
by: Amit | last post by:
Hi when I try to run LIST ACTIVE DATABASES AT DBPARTITIONNUM <partnum> or LIST ACTIVE DATABASES GLOBAL, I always get an error message. Does anyone know why? I'm on v8 fp 5 output : db2 => list...
by: Jack Li | last post by:
Hi All, I have DB2 EEE 7.2 12 db partitions running on AIX 5.1ML5 P690( one server). The AIX workload manager is on. I started the same peoplesoft job on all 12 nodes at the same time. But some...
by: jcgeorge | last post by:
I have a Windows DPF (v8.2.2) environment. 2 Nodes 5 Partitions Server1 - Cat (0) Data (1) Data (2) Server2 - Data (3) Data (4) I want to use block-based IO, but I do not want the same size...
by: arunrocks | last post by:
Hi I am having a requirement to create a db in 2 out of 8 partitiones. I have the following doubts. 1. should I create a new instance in 2 partitions alone (the present instance spans 8 nodes)...
by: Computer Guru | last post by:
Does .NET have a wrapper to list actual physical drive volumes on the local PC? My.Computer.Filesystem.Drives lists the partitions and volumes that have drive letters attached. I'm looking to...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.