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

  • Home
  • SEARCH
  • 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 8667061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:52:46+00:00 2026-06-12T17:52:46+00:00

Whis scripts read from a source with lines consisting of artist names followed by

  • 0

Whis scripts read from a source with lines consisting of artist names followed by a parenthesis with information about whether the artists cancelled and which country they come from.

A normal sentence may look like:

Odd Nordstoga (NO) (Cancelled), 20-08-2012, Blå

As I import the data I decode them into UTF-8 and this works fine. Uncommenting the second comment in the else block of the remove_extra() method shows that all variables are of type Unicode.

However, when a value is returned and put into another variable and the value of this is tested, the majority of the variables seems to be of NoneType.

Why does this happen? And how can it be corrected? Seems to be an error happening between the method return and assignment of the new variable.

# -*- charset: utf-8 -*-

import re


f1 = open("oya_artister_2011.csv")

artister = []
navnliste = []

PATTERN = re.compile(r"(.*)(\(.*\))")
TEST_PAT = re.compile(r"\(.*\)")

def remove_extra(tekst):
    if re.search(PATTERN, tekst) > 1:
        after = re.findall(PATTERN, tekst)[0][0]
        #print "tekst is: %s   " % tekst
        #print "and of type: %s" % type(tekst)
        remove_extra(after)

    else: 
        #print "will return: ", tekst
        #print "of type: %s" % type(tekst)
        return tekst


for line in f1:
    navn, _rest = line.split(",",1)
    navn = navn.decode("utf-8")
    artister.append(navn)


for artist in artister:
    ny_artist = remove_extra(artist)
    #print "%s" % ny_artist
    print "of type: %s" % type(ny_artist)
  • 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-12T17:52:47+00:00Added an answer on June 12, 2026 at 5:52 pm

    Try

    return remove_extra(after)
    

    instead of just

    remove_extra(after)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my app I need to avoid the saving state, in fact, I whis
I'm trying to get an html table from a dynamic php page on my
I am trying to get names of restaurants, their addresses and their phone numbers.
Whis is apr_pool in the Subversion API?
I have a rails app with a heavy initial data in the database. Everytime
I have an anoying problem that is giving me a hard time these days...
How can I find my PreferenceActivity instance, which was created by a framework? *
I'm writing a wrapper in Java for a C++ program. The wrapper is done
I'm new to database design and am currently using MySQL Workbench to help me
I'm using Linq to Sql (in fact it's Dynamic Linq to SQL that allows

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.