Avatar ·

How to split an integer into separate digits and output them separated by commas?

📁 List, string, Advanced Python Topics, example

For example, there is a variable a = 987.

How to output it in this format:

9, 8, 7

It is possible to do it with a for() loop and then write it to a list and output it using split with a comma, but that would be a lot of code. How can this be implemented more simply?