D
D
daniel12014-02-17 17:35:53
Python
daniel1, 2014-02-17 17:35:53

How to find out logical drives in a Python script?

Hello. I'm interested in the following question - how to find out logical drives in a Python script?
I have the following solutions -
1. Use IronPython. .NET has corresponding functions for getting logical drives.
2. Iterate over the letters of the English alphabet and see when exceptions are thrown.
But these options are not very suitable.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kenny_opennix, 2014-02-17
@kenny_opennix

Here on C#
computerid.codeplex.com/SourceControl/latest#Compu...
UPD:
You can learn purely in python using the os module

import os
print os.getenv("SystemDrive")

The result will return the drive letter as seen in the screenshot below.
fb927cda61a0099689753149ec531d50.png

M
MagNet, 2014-02-18
@MagNet

Second link from Google:
stackoverflow.com/a/827397/1105714

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question