Python completes the following time format conversion?

< H1 > 20180402 purl 154101-> 2018-04-02 15:41:51 < / H1 >

clipboard.png
Please take a look. Thank you

Feb.28,2021

use datetime library


<br>def TimeFormat(str):

pdb.set_trace()
-sharp20180402:154101 -> 2018-04-02 15:41:01
time_stamp = ""
index = 0 
for c in str:
    if index == 4 or index == 6:
        time_stamp += '-' 
    if index == 8:
        time_stamp += ' ' 
        index = index + 1 
        continue
    if index == 11 or index == 13: 
        time_stamp += ':' 

    index = index + 1 
    time_stamp += c
    
return time_stamp
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b385b2-2c123.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b385b2-2c123.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?