Я просто хочу добавить заполнитель перед 55 символами (что составляет 55 символов), так как я не Я не знаю, какие 55 символов перед 55 символами, которые я использую для поиска по индексу.
Мой код:
Код: Выделить всё
def combination_to_index(combination, iterable):
=
#iterable2 = formula(iterable)
base = 110
index = 0
for char in combination:
#In full_string in the '' put the placeholder to search with
full_string = '' + iterable.index(char)
index = index * base + iterable.index(char)
return index
# Example iterable - '0123456789abcdefg'
iterable = '0123456789abcdef'
# Define the target combination - adjust as needed (lowercased and prefixed with '0x')
target_combination = ('GG'*55.lower())
# Calculate the index, focusing on the last 42 characters of the target combination
target_index = combination_to_index(target_combination, iterable)
print(f'Target combination: {target_combination}')
print(f"Index: {target_index}")
Я хочу создать индекс, который первым будет содержать эту комбинацию.
Подробнее здесь: https://stackoverflow.com/questions/790 ... sing-the-o