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 8640687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:20:26+00:00 2026-06-12T11:20:26+00:00

I have an enormous string and I’ve created a list of all the matching

  • 0

I have an enormous string and I’ve created a list of all the matching patterns in that string called ‘found’. I’ve also created a list of all the locations of said patterns called ‘locations’. Now I want to print the pattern found and its corresponding location all in one line, separated by a tab, but i’m getting tripped up on the loops. Here’s my latest attempt:

for i in found:
    print i + '\t' + locations['i']

but I obviously get an error. I can get it to print the locations or the patterns or one then the other, but i’m not quite sure how to get them all on the same line.

edit: the variables are found = a list of strings (patterns found in the overall string) and locations = a list of the locations of said patterns found using re.finditer

eitehr way, zip() worked perfectly for my needs. thanks.

  • 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-12T11:20:28+00:00Added an answer on June 12, 2026 at 11:20 am

    try zip():

    for i,j in zip(found,locations):
        print "\t".join((i,str(j)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My issue is that I have a big, enormous list for the AutoComplete. Example:
I have an enormous file of HTML that I'd like to convert to one
We have an App for iOS that renders an enormous amount of text: http://itunes.apple.com/br/app/biblia-sagrada/id370178518?mt=8
We have an enormous program that is generating too much garbage. This is hurting
I have a gridview with an enormous viewstate that I am attempting to shrink.
I have a program that prints UTF-8 string to the console: #include <stdio.h> int
I have this enormous database : # # Dropping tables # DROP TABLE IF
I have an enormous MySQL (InnoDB) database with millions of rows in the sessions
I have a rather enormous project in which I'm trying to retrofit in-memory data.
Experts out there - quick question... In Excel VBA, I have created a class

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.