I'm parsing a file and want to find wherever either <color = orange>
or <color>
starts in my file.
Then I want to pull out the value orange.
How would I do this with regular expressions.
So far I have this (which isn't sufficient since it doesn't look for the case where color has a value):
def main():
basefile = open ("base.txt")
libfile = open ("file.txt")
lines = []
while 1:
line = libfile.readline()
lines.append("%s" % libfile.readline())
if not line:
break
inlibrary = 0
newlibrary = []
for line in lines:
if "<color>" in line: