Select a part of an element of a list with Index - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Select a part of an element of a list with Index (/thread-20407.html) |
Select a part of an element of a list with Index - BollerwagenIng - Aug-09-2019 I've created a list with a for loop and got elements with many elements... How can I make this easier? cmc = [] CYC1 = cmc[0] CYC2 = cmc[1] CYC3 = cmc[2] CYC4 = cmc[3] c = [] c.append(CYC1[67:79]) c.append(CYC2[67:79]) c.append(CYC3[67:79]) print(c)you don't need the intermediate cyc variables: for i in range(4): c.append(cmc[i][67:79]) |