All pastes #172561 Raw Edit

Mine

public text v1 · immutable
·published 2006-09-16 05:33 UTC
rendered paste body
plantRegex = re.compile('^(Plant:)(.*)')
kernelRegex = re.compile('^(Kernel:)(.*)')
updateRegex = re.compile('^(Update:)(.*)')
archRegex = re.compile('^(Architecture:)(.*)')
providesRegex = re.compile('^(Provides:)(.*)')
dependsRegex = re.compile('^(Dependes:)(.*)')
filesRegex = re.compile('^(Files:)(.*)')

allRegexps = (
  plantRegex,
  kernelRegex,
  updateRegex,
  archRegex,
  providesRegex,
  dependsRegex,
  filesRegex
)
  
for line in plantData:
    tab = line.strip()
    if tab == "" and plant != 0:
        continue

    for regex in allRegexps:
      m = oneRegex.match(tab)
      if m:
        # do something with m.group()
        break

    # and so on ...