- qspec. make_str_iterable_unique ( a , identifier=None )[source]
-
Make the values of a list of strings unique by appending identifiers to values that appear more than once. Equal values are grouped together, e.g.,
["a", "b", "c", "b", "d"]becomes["a", "b_0", "b_1", "c", "d"]or["a", "b_" + identifier[0], "b_" + identifier[1], "c", "d"].- Parameters:
-
- aIterable[str]
An iterable of
strvalues.- identifierIterable[str] | None
An iterable of
strvalues to append to the values ofaif they appear more than once. IfNone,"_i"is appended to thei-th appearance of a value ina.
- Returns:
-
- a_uniquelist[str]
The unique values.