when I set start_urls inside a Scrapy spider class, the fllowing code is OK:
class InfoSpider(scrapy.Spider):
    name = 'info'
    allowed_domains = ['isbn.szmesoft.com']
    isbns = list(set(pd.read_csv('E:/books.csv')['ISBN']))
    url = 'http://isbn.szmesoft.com/isbn/query?isbn='
    start_urls = [url + isbns[0]]
But then I got the error  Scrapy: NameError: name 'url' is not defined when I rewrite my code as follows:
class InfoSpider(scrapy.Spider):
    name = 'info'
    allowed_domains = ['isbn.szmesoft.com']
    isbns = list(set(pd.read_csv('E:/books.csv')['ISBN']))
    url = 'http://isbn.szmesoft.com/isbn/query?isbn='
    start_urls = [url + isbn for isbn in isbns[:3]]
Maybe I can solve this problem in other ways,but I want to know the reason for the ERROR
 
     
    