diff options
Diffstat (limited to 'Lib/uuid.py')
-rw-r--r-- | Lib/uuid.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py index 7a12b48cb00..6f7a7a3f42a 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -321,9 +321,8 @@ class UUID: raise TypeError('UUID objects are immutable') def __str__(self): - hex = '%032x' % self.int - return '%s-%s-%s-%s-%s' % ( - hex[:8], hex[8:12], hex[12:16], hex[16:20], hex[20:]) + x = self.hex + return f'{x[:8]}-{x[8:12]}-{x[12:16]}-{x[16:20]}-{x[20:]}' @property def bytes(self): @@ -387,7 +386,7 @@ class UUID: @property def hex(self): - return '%032x' % self.int + return self.bytes.hex() @property def urn(self): |