<- Back | Index | Forward ->

SMARTS Searches

SMARTS queries are hard to use in C

Use list attributes to simpify everything:

  from daylight import Smiles, Smarts

  pat = Smarts.compile("CC[N,C]")
  mol = Smiles.smilin("OCCCN")  # made-up molecule
  paths = pat.match(mol)
  for path in paths:
    for atom in path.atoms:
      print atom.symbol,
Compare this Python code with the C code on the next page.