[Tutor] HD/DVD/CD
John Fouhy
john at fouhy.net
Wed Jan 4 03:00:09 CET 2006
On 04/01/06, Terry Carroll <carroll at tjc.com> wrote:
> I hope someone more artful than I can show a quick and easy way to convert
> either '758C87F3' or -1972144115 to the '8A73780D' that is your goal.
Hmm, well,
>>> i = -1972144115
>>> '%X' % (pow(2, 32)-(~i+1))
'8A73780D'
Although my bitwise arithmetic's feeling pretty rusty..
But ---
C:\Games\Civilization III\Conquests>dir d:
Volume in drive D is CIV3CQST
Volume Serial Number is 49BC-31DB
...
>>> import win32api
>>> cdi = win32api.GetVolumeInformation('D:/')
>>> '%X' % cdi[1]
'49BC31DB'
So, on my system (ActivePython 2.4, WinXPpro) there is no need for magic.
I've got Mark Hammond's pywin32 book, but it doesn't talk about
win32api.GetVolumeInformation().
--
John.
More information about the Tutor
mailing list