Call class variable indice value upon instantiating


Im rusty on classes, and thus I dont understand how to properly instantiate my own right now.

Here is the class

import scrapy

class Se(scrapy.Spider):

    def parse(self, seach_engine, site_to_parse, page_start, page_end, response):
        seach_engine = [

        site = str(seach_engine+site_to_parse)
        if site_to_parse == seach_engine[0]:
            print("executing against se1!")
        elif site_to_parse == searh_engine[1]:
            print("executing against se2!")
            print("Something bad happened.")

I've learned I can instantiate this class via terminal like

>>> from Scrapse import Se
>>> s = Se.parse()

The problem is, for the first param (technically the second) for search_engine i want to instantiate s var for the first indice value in search_engine for

How can i do this?


Show source
| class   | python   | instantiation   2017-01-07 23:01 0 Answers

Answers ( 0 )

◀ Go back