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?
epicSHOOTER236
0
Newbie Poster
Recommended Answers
Jump to Postimport 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 …
All 2 Replies
Reply to this topic
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.