Untitled
unknown
plain_text
a year ago
541 B
10
Indexable
def get_dbs_id(string):
partial_parts = [(0, 0.1), (0.45, 0.50), (0.65, 0.85),(0.9, 1)]
str_count = len(string)
slice_parts = [(int(_min*str_count), int(_max*str_count)) for _min, _max in partial_parts]
dbs_id = []
for _min, _max in slice_parts:
if _max - _min > 400:
dbs_id.append(string[_min: _min + 400])
else:
dbs_id.append(string[_min: _max])
return '-'.join(dbs_id)
# Sample use:
# convert databytes with base64 str
dbs_id = get_dbs_id(data_base64_str)Editor is loading...
Leave a Comment