How to add a colon in a string, Python?
I've got an array of elements of 4 numbers that are classed as strings, and I want to add a colon in between 2 of the numbers of every element so it looks like a time, but how do you do this:
STarray = ['0712', '0819', '1131', '1352', '1401']
You can use list comprehensions for this.
Something like
STarray = [f"{el[:2]}:{el[2:]}" for el in STarray]