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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:16:39+00:00 2026-06-18T06:16:39+00:00

I have a list of data in CSV file. I am using loop to

  • 0

I have a list of data in CSV file.

I am using loop to make them into fields… I need a code that look for a field in code that do not match this type of code “[A9]9AA9#9” Lets say “A” can be any letter and “9” can be any number. However [ ] and # symbol must be in the same location as in format.

def code():
    match= 0
    tree_file.readline() # skip first row
    for row in tree_file: 
        field=row.strip()
        field=field.split(",") # make Into fields
        code=(field[4])        
        if code != "[X9]9XX9#9":   #HERE SHOULD BE THE CODE
            match+=1        

Please can you leave some comment in code so I can understand them because I can’t understand how other solution that are available is relevant to my problem.

  • 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-18T06:16:40+00:00Added an answer on June 18, 2026 at 6:16 am

    The regular expression you need is:

    r'\[[A-Za-z][0-9]+\][0-9]+[A-Za-z]{2}[0-9]+#[0-9]+'
    

    So the code can be like

    import re
    
    if re.search(r'\[[A-Za-z][0-9]+\][0-9]+[A-Za-z]{2}[0-9]+#[0-9]+', code) is None:
        match += 1  
    

    Explanation

    [A-Za-z] : matches any alphabet
    [0-9]+ : matches one or more digits
    [A-Za-z]{2} : matches two alphabets
    

    Output

    >>> import re
    >>> s = "[X9]9XX9#9"
    >>> re.search(r'\[[A-Za-z][0-9]+\][0-9]+[A-Za-z]{2}[0-9]+#[0-9]+', s) is None
    False
    >>> s = "ABCD"
    >>> re.search(r'\[[A-Za-z][0-9]+\][0-9]+[A-Za-z]{2}[0-9]+#[0-9]+', s) is None
    True
    >>> s = "[A123]456BB8#789"
    >>> re.search(r'\[[A-Za-z][0-9]+\][0-9]+[A-Za-z]{2}[0-9]+#[0-9]+', s) is None
    False
    >>> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for my application i have to parse CSV file using Erlang.following is the code
I have retrieved data from a 2-column CSV file using HashMap. This is for
I have an application that loads data from a .csv file and shows it
I have a large file, with 1.8 million rows of data, that I need
I have a list of data points (0.2, 0.8, 0.95) that I want to
I have a list of data in javascript that looks like this: [[152, 48,
I have a list of data that is a schedule. Each item has a
I have a long list of data that I want to display in table
I have some C structures related to a 'list' data structure. They look like
I have a small script we're using to read in a CSV file containing

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.