Combining strings and ints to create a date string results in TypeError

The following should work:

finaltimes = ['{}/{}:{}'.format(*tpl) for tpl in zip(dd, hh, m)]

Try some thing like this:

finaltimes.append(f"{list1}/{list2}:{list3}")

You can use a formatted string:

dd = [23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27]
hh = [21, 23, 7, 9, 16, 19, 2, 5, 12, 15, 22, 1, 8, 11, 18, 21, 2, 8, 12, 12, 13, 13, 18, 22]
mm = [18, 39, 3, 42, 52, 43, 46, 41, 42, 35, 41, 27, 37, 30, 0, 58, 57, 51, 11, 20, 18, 30, 35, 5]

finaltimes = [f"{d}/{h}:{m}" for d,h,m in zip(dd,hh,mm)]

print(finaltimes)

Output:

['23/21:18',
 '23/23:39',
 '24/7:3',
 '24/9:42',
 '24/16:52',
 '24/19:43',
 '25/2:46',
 '25/5:41',
 '25/12:42',
 '25/15:35',
 '25/22:41',
 '26/1:27',
 '26/8:37',
 '26/11:30',
 '26/18:0',
 '26/21:58',
 '27/2:57',
 '27/8:51',
 '27/12:11',
 '27/12:20',
 '27/13:18',
 '27/13:30',
 '27/18:35',
 '27/22:5']

Tags:

Python