uid()¶
- audeer.uid(*, from_string=None, short=False)[source]¶
Generate unique identifier.
A unique identifier contains 36 characters with
-
at position 9, 14, 19, 24. Ifshort
isTrue
, only the last 8 digits are returned.- Parameters
from_string (
Optional
[str
]) – create a unique identifier by hashing the provided string. This will return the same identifier for identical strings. IfNone
uuid.uuid1()
is used.short (
bool
) – ifTrue
returns a short unique identifier (last 8 digits)
- Return type
- Returns
unique identifier
Examples
>>> uid(from_string="example_string") '626f68e6-d336-70b9-e753-ed9fad855840' >>> uid(from_string="example_string", short=True) 'ad855840'