I am trying to add timestamp to writelines() so that I get the timestamp in between the bullet point and the hyphen in the code below:
from datetime import datetime
datetime.now()
A = ['ABC', 'PQR', 'XYZ']
f = open("test.dat", 'w')
f.writelines(list(u'\u27B3 - %s\n'.encode('utf-8') % i for i in A))
f.close()
Output
➳ - ABC
➳ - PQR
➳ - XYZ
Desired output
➳ 18:15:02 - ABC
➳ 18:15:02 - PQR
➳ 18:15:02 - XYZ