Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Get all values of for loop with an index
I've read a text file and got my ten lines with a for loop:
j = 871
counter = list(range(10))
for i in counter:
    CYC1=('\n'.join(map(str, f06FileSpecM1[j+i:j+i+1])))
    print(CYC1) [color=#2ECC71]#if I let it print here I get all lines but if I go out of the for loop I get again only the last line[/color]
Now I want to get a value with the index [62:71]. Its for all ten lines the same. But if I try it with:
cmm = (CYC1[62:71]
I only get the value of the last line.
How is it possible to get all the ten values?
Thanks for your help :D
Append the items to a list.
Yes! I made an append but now my new list has 10 elements. How can I split them to get every element fro 62 to72? Already tried with another for loop ://

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  For loop prints strane values? colt 2 338 Sep-22-2019, 02:01 AM
Last Post: ichabod801
  change array column values without loop khalidreemy 2 434 May-05-2019, 09:05 AM
Last Post: DeaD_EyE
  Index error using pop in nested loop PerksPlus 3 658 Mar-28-2019, 03:11 PM
Last Post: ichabod801
  randint stops changing values in a loop Naito 4 765 Jan-30-2019, 08:15 AM
Last Post: perfringo
  index between values mapvis 3 783 Jan-04-2019, 11:28 AM
Last Post: perfringo
  Need help for finding cumulative values in a loop Lightning1800 10 1,848 May-23-2018, 07:48 PM
Last Post: Lightning1800
  Generating list of rsquared_adj regression values for variating i with loop hpg 1 1,215 Apr-18-2018, 07:33 PM
Last Post: nilamo
  Using values from a list of tuples within a loop jtpy 5 1,210 Mar-11-2018, 08:31 AM
Last Post: jtpy
  For Loop, over even index shaynehansen 2 1,435 Jul-24-2017, 07:08 PM
Last Post: Larz60+
  newbie while loop error: IndexError: list assignment index out of range msa969 3 65,758 Mar-31-2017, 12:24 PM
Last Post: msa969

Forum Jump:

Users browsing this thread: 1 Guest(s)