Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Use Python’s built-in uuid module: pass the value to uuid.UUID() and catch ValueError if it cannot be parsed. If you need to require the usual hyphenated spelling rather than accept other valid UUID representations, compare the parsed value with its normalized string form.
Parse a GUID string with Python’s built-in module
Python’s uuid module can parse UUIDs, also known as GUIDs. A third-party package is not needed for this basic check. For string input, an unparseable value raises ValueError.
import uuid
def is_uuid(value: str) -> bool:
try:
uuid.UUID(value)
except (ValueError, TypeError, AttributeError):
return False
return True
The extra TypeError and AttributeError catches make this helper return False for unexpected inputs such as None. If the function contract guarantees that value is a string, catching ValueError alone is sufficient.
Decide whether alternate spellings are acceptable
uuid.UUID(value) is a parser, not a check that the original text uses one exact spelling. Python documents that braces, hyphens, and the urn:uuid: prefix may be omitted. If any representation Python accepts is fine, successful parsing is enough.
#1 Best Overall
To require the conventional hyphenated text form while allowing uppercase or lowercase letters, compare the original value with the parsed UUID’s normalized string:
import uuid
def is_canonical_uuid(value: str) -> bool:
try:
parsed = uuid.UUID(value)
except (ValueError, TypeError, AttributeError):
return False
return str(parsed) == value.lower()
This accepts uppercase letters in the hyphenated form, but rejects other parseable spellings such as braces, omitted hyphens, or a URN prefix. The check treats the conventional hyphenated spelling as the requirement; it does not require lowercase input.
Rank #2
Add version or variant checks only when required
Parsing establishes that Python can construct a UUID from the representation. It does not enforce an application-specific UUID version or variant. If your requirements specify one, parse the value first, then inspect parsed.version or parsed.variant as a separate policy check. Python documents these attributes, and RFC 9562 describes version and variant as parts of UUID structure.
What GUID and UUID mean
RFC 9562 uses UUID (Universally Unique IDentifier) and GUID (Globally Unique IDentifier) for the same identifier family. A UUID is 128 bits; its ordinary text representation groups hexadecimal digits with hyphens, and the letters may be uppercase, lowercase, or mixed case.
Recommended Free Tools
For exact parsing behavior and UUID object attributes, see the Python 3.14.8 uuid documentation. For the UUID definition and format, see RFC 9562.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




