Wie würde ich lst1 in lst2 umwandeln, indem ich Element 1 mit Element 2 verbinde und so weiter.Listenverständnis, das alle zwei Elemente zusammen in einer Liste verbindet
lst1=[' ff 55 00 90 00 92 00 ad 00 c6 00 b7 00 8d 00 98 00 87 00 8a 00 98 00 8f 00 ca 01 78 03 54 05 bf']
zu
lst2=[ff55, 0090, 0092, 00ad, 00c6, 00b7, 008d, 0098, 0087, 008a, 0098, 008f, 00ca, 0178, 0354,05bf]
versucht, wurde aber als nicht gesühnt
for i in lst:
lstNew = []
tempList = i.split()
lenList = len(tempList)
#print tempList
index = 0
while (index < lenList):
print tempList[index] + tempList[index+1]
index = index + 2
oder '[a + b für a, b in zip (...)]' wenn dir das besser gefällt :-) – mgilson
ya :) das sieht besser aus –
Du verpasst das schließende ']' für 'lst' –