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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:19:07+00:00 2026-05-24T18:19:07+00:00

so i made this program where it take a guitar tab and gets the

  • 0

so i made this program where it take a guitar tab and gets the fret number and runs it through a dictionary which gets the note and searches for it in the uke note dictionary.

but my probleme is if i have a tab in a txt file ex:

|-----11----------11----------11------11--13--11----------11----------11----------11------11--13--11---------------|
|-------13----------13----------13--------------------------13----------13----------13-----------------------------|
|--13-----13---13-----13---12-----12---------------12-13------13---13-----13---12-----12--------------------------|
|------------------------------------------------------------------------------------------------------------------|
|------------------------------------------------------------------------------------------------------------------|
|------------------------------------------------------------------------------------------------------------------|

So what i would want would be to open the txt file and put a letter in front of each number corosponding with the line. so every number on the first line would have say a “e”,second line:”B” and third:”G”

And have it in order so that the end result would be: G13 e11 B13 G13 etc…
Any ideas?

  • 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-05-24T18:19:10+00:00Added an answer on May 24, 2026 at 6:19 pm

    For the parsing, write a function that takes a line of tabs and a note, that yields the frets along with the position:

    import re
    
    def parse_line(line, note):
        fret_pattern = re.compile(r'\d+')
        for match in fret_pattern.finditer(line):
            yield (match.start(), ''.join((note, match.group(0))))
    

    For the first line, |-----11--, this will yield (6, "e11"). The tuples can be used later to sort all notes on all strings.

    Now just open() the file, read in the first 6 lines and give them the correct names:

    import itertools
    
    notes = ['e', 'B', 'G', 'D', 'A', 'E']
    with open('tab.txt') as fp:
        # Read-in 6 lines
        lines = itertools.islice(fp, 0, 6)
    
        # Holds all the notes.
        frets = []
    
        # Process the lines, append all notes to frets.
        for note, line in itertools.izip(notes, lines):
           frets.extend(parse_line(line, note))
    
        # Sort the frets by position.
        frets.sort()
    
        # Drop the positions.
        frets = [fret for pos, fret in frets]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take note of the code for this small WPF C# program made with Microsoft
This program is supposed to take in a three digit number and change it
I made this bash one-liner which I use to list Weblogic instances running along
I've made this decorator, which results in an infinite redirect loop. The problem is
I made a program which is still in development. I did not declared main
I have made the following method which runs hard-coded xPath queries in a hard-coded
I made a program whose major function is use API to take photos and
Made this nice little loop for hiding and showing div's, works as a charm
I made this little Cocoa app with a WebView that displays Google Maps in
I made this code with jQuery to fade images ( but not the one

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.