I
I
Ivan21212015-04-18 14:10:26
Python
Ivan2121, 2015-04-18 14:10:26

What is the easiest way to combine two parsers into one in python?

What is the easiest way to do this? There is a parser script using grab in python, but for each site I run each script separately, I would like to combine them all into one. Do I need to use object-oriented programming?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
egocentrist, 2015-04-23
@egocentrist

More or less like this:

parser1.py
class bar:
 def foo(site):
  g.go(site)

parser2.py
class foo:
 def bar(site):
  g.go(site)

parser1+2.py
include parser1
include parser2

p1=parser1()
p2=parser2()

p1.bar.foo('http://site')
p2.foo.bar('http://site')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question