Python - How to find UUID of computer and set as variable
<p>I have been looking all over the internet for a way to find a way to get UUID for a computer and set it as a variable in python. </p>

<p>Some of the ways I tried doing didn't work.</p>

<p>Original idea:</p>

<pre><code>import os
x = os.system("wmic diskdrive get serialnumber")
print(x)
</code></pre>

<p>However this does not work, and only returns 0. </p>

<p>I am wondering if their is a way i can find a unique Harddrive ID or any other type of identifier in python. </p>

<p>You can use <a href="https://docs.python.org/2/library/uuid.html#uuid.uuid1" rel="nofollow"><code>uuid1</code></a> from the standard library <code>uuid</code> module:</p>

<pre><code>import uuid
myuuid = uuid.uuid1() 
</code></pre>

<p>This can be used to:</p>

<blockquote>
  <p>Generate a UUID from a host ID, sequence number, and the current time.</p>
</blockquote>

<p>However, please note that you should be careful where you use this uuid because it </p>

<blockquote>
  <p>may compromise privacy since it creates a UUID containing the
  computerâs network address.</p>
</blockquote>

<p>If this is not what you are looking for, <a href="https://docs.python.org/2/library/uuid.html#module-uuid" rel="nofollow">the <code>uuid</code> modul</a>e has lots of other good ways to generate uuids.</p>

<p>Also, see <a href="http://stackoverflow.com/a/4194146/3642398">this answer</a> for detailed instructions on how to get a harddrive serial number with Python, if that is what you are looking for.</p>

python python-3.x hwid