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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:24:44+00:00 2026-05-28T05:24:44+00:00

I have some sample data like so: MADISON COUNTY,,,,,,,,,,,,, London, City of,,,,,,,,,,,,597,519 2.1,mill /s,(replacement),for,5

  • 0

I have some sample data like so:

MADISON COUNTY,,,,,,,,,,,,, "London, City of",,,,,,,,,,,,597,519
2.1,mill /s,(replacement),for,5 years,",",commencing in,2007,",",first due in calendar year,2008,",",, for current operating expenses
-,,,,,,,,,,,,, London Public Library District,,,,,,,,,,,,716,869 1.2,mill /s,(replacement),"& increase of 1.7 mills, for 15 years, commencing in 2007, first due in",,,,,,,,,, "calendar year 2008, for
current expenses -",,,,,,,,,,,,, "Range, Township of",,,,,,,,,,,,62,13
1.7,mill /s,(renewal),for,5 years,",",commencing in,2007,",",first due in calendar year,2008,",",, for fire protection -,,,,,,,,,,,,,

What I need at the end is a list of all “Towns”, so the output should be:

["London, City of", "London Public Library District", "Range, Township of"]

I’m at a bit of a struggle here because I don’t really know how to approach narrowing it down to just these fields. As you can see the series of commas is a pretty good start, but there are also unwanted strings of commas that don’t follow the pattern. Originally I thought I would match for 5 commas on both sides of the string with length < 100 chars, but this is frustrated by the arbitrary commas here:

first due in",,,,,,,,,, "cale

Any clues?

Further, the data is generally in this format:

SOME COUNTY,,,,,,,,,,,,, SOME TOWN,,,,,,,,,,,,some long string possibly with commas
,,,,,,,,,,,,, SOME TOWN,,,,,,,,,,,,some long string possibly with commas ... etc
  • 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-28T05:24:44+00:00Added an answer on May 28, 2026 at 5:24 am

    It’s hard to tell from your sample data as I think it has extra line breaks in it, but from your summary of the data format it seems that the Town is the 14th column in each line.

    As the data is in CSV format, you don’t need to use a Regular Expression and instead can use the csv module to parse the data. Extracting the town names should be as easy as:

    import csv
    
    with open('data.csv') as f:
        for row in csv.reader(f):
            print row[13]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these two table with some data sample in them. I would like
I have some sample data like so: var data = { section: { 1:
I have an 'articles' collection, some sample data might look like this: [ {body:
I have some data in .cvs. I would like to make a simple barplot
I have a txt file, here is some sample data: Id,PriceOne,Company,PriceTwo,PriceThree 11,15.3599997,Japan ltd,12.23,3.1777777 12,,Koyoto
I have some sample webservice like below, <WebMethod()> _ Public Function ExecuteCMD() As Boolean
I have the following script that parses some | delimited field/value pairs. Sample data
I could not think of a proper title. I have some data like -
I have some very simple sample code like this: $.ajax({ url: 'demo2.htm', success: function(loadeddata){
I have some very simple sample code like this: $.ajax({ url: 'demo2.htm', success: function(loadeddata){

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.