Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8039759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:40:41+00:00 2026-06-05T03:40:41+00:00

I would like to iterate a script along columns in a text file but

  • 0

I would like to iterate a script along columns in a text file but ignoring the first 5 columns.

Currently my script runs through a text file row by row assessing the values in column 6. I would like it to then run through all the rows assessing column 6, then column 7, then column 8 etc
I DO NOT want to assess each column for every row as the script reads through the file, but to run through the entire file assessing column n and then repeat for column n + 1

Currently I have the simple:

for line in Input:
    line = line.rstrip() 
    fields = line.split("\t")
    for col in row:

but I’d like to specify that it ignores the first 5 columns, as these are not targets (but are still needed as information in the file).

I guess something like for col in row for range 6:20 might work, but I am a python beginner and don’t know the correct way to express this in python. Please let me know how I can clarify the question if it is too confusing.

Thank you in advance for your help.

Best,

Rubal

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:40:43+00:00Added an answer on June 5, 2026 at 3:40 am

    If you have a list row, then row[a:b] is the range of elements starting with element number a and up to but not including element number b.

    For example:

    row = ['alpha', 'beta', 'gamma', 'delta', 'epsilon']
    
    print row[2:4]
    

    The output of this would be

    ['gamma', 'delta']
    

    And so in a loop you can write:

    for col in row[6:20]:
        foo()
    

    Alternatively, loop to the end of the list with

    for col in row[6:]:
        foo()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a script in jQuery that would iterate through each text
Given a text file with multiple lines, I would like to iterate over each
I would like to iterate the rows and columns separately on a two dimensional
I would like to iterate through an array that covers every pixel on my
Here's the situation: I would like to iterate through a table with input controls,
When 'login' button is clicked I would like to iterate through a column in
I would like to randomly iterate through a range. Each value will be visited
Does map() iterate through the list like for would? Is there a value in
In a shell script I'm looking to iterate over an array like I would
Given some sets (or lists) of numbers, I would like to iterate through the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.