so I need to be able to open a text file, and when a button is pressed it searches for a tag in the file such as <l1> and anything after that tag would be put into a label. how would I go about doing this?

import re #module
f = open(raw_input("file"))
regexp = re.compile("<.*>") #pattern
firsttag = re.search(regexp,f.read()).group() #search gives a match object but i need the text, so use group with no args
labeltext = labeltext.strip(firsttag) #get rid of firstag

Sorry but the button thing is kinda hard, but I can give you that.

also it is not always going to be the same text, will this still work?

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.