This is a very basic question, but I'm very new to python. I want to read data in a file. The data is between two delimiters. I'm not exactly sure how I can extract the data and skip the delimiters. Any help would be great.

You can use this little function ...

def extract(text, sub1, sub2):
    """
    extract a substring from text between first
    occurances of substrings sub1 and sub2
    """
    return text.split(sub1, 1)[-1].split(sub2, 1)[0]

str1 = "<a href='http://www.google.com'>more stuff here</a>"
str2 = extract(str1, "='", "'>")

print( str1 )
print( str2 )  # http://www.google.com
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.