How can I convert time_1 into time_2?
>>> time_1 = '2019-01-01T00:00:00-06:00' >>> time_2 = ??? >>> print(time_2) "'2019-01-01T00:00:00-06:00'" I have tried the following, but it gives the wrong output:
>>> time_1 = '2019-01-01T00:00:00-06:00' >>> time_2 = "'" + time_1 + "'" >>> print(time_2) '2019-01-01T00:00:00-06:00' Which is how time_1 looks like, not how time_2 should look like.
I know that when I go to print time_2, its output looks like time_1, but that's the point of this question - I want the printed output to look like time_2.
\'or\"time_q, you are putting single quotes aroundtime_1to get totime_2. I.e.time_2 = f"'{time_1}'"'2019-01-01T00:00:00-06:00'". So, exactly the same as what yours gives.