I have this string my_string = '717460881855742062' how can I split it in half? The string is auto-generated so just splitting by the 1 won't work
2 Answers
Something like this should do the job:
my_string = '717460881855742062' length = int(len(my_string) / 2) first_part = my_string[:length] second_part = my_string[length:] print(first_part) print(second_part)
output:
717460881
855742062
You can modify it and make sure you take also handle the situation where the length%2 is not 0.
len(...)?