n = 1234 # convert integer to list of digits list_of_digits = list(map(int, f"{n}")) # convert list of digits back to number number = int(''.join(map(str, list_of_digits)))
Here is what the above code is Doing:
1. Convert the integer to a string.
2. Convert the string to a list of characters.
3. Convert the list of characters to a list of integers.
4. Convert the list of integers to a string.
5. Convert the string to an integer.