I am looking for the longest characters string in a list with tuple couples. But only on the first element of all tuples.
VMT = [('T_WIN2019_04.2020', 'Microsoft Windows Server 2016 (64-bit)'), ('T_CENTOS_7.8_04.2020', 'CentOS 7 (64-bit)'), ('T_WIN2016_05.2019', 'Microsoft Windows Server 2016 (64-bit)'), ('T_W2019_STD_EN', 'Microsoft Windows Server 2016 (64-bit)'), ('T_W2016_DTC_EN', 'Microsoft Windows Server 2016 (64-bit)')]
I use this :
max(VMT, key=len)[0]
'T_WIN2019_04.2020'
T_WIN2019_04.2020 = 16 chars
Should be :
'T_CENTOS_7.8_04.2020'
T_CENTOS_7.8_04.2020 = 20 chars
I think the calculation is done on the whole tuple but not the first element of tuples.