I want to write to csv file in scrapy
for rss in rsslinks:
item = AppleItem()
item[\'reference_link\'] = response.url
base_url = get_base_url(response
You need to
You could approach it like:
fields = ["reference_link", "rss_link"] # define fields to use
with open(filename,'a+') as f: # handle the source file
f.write("{}\n".format('\t'.join(str(field)
for field in fields))) # write header
for item in items:
f.write("{}\n".format('\t'.join(str(item[field])
for field in fields))) # write items
Note that "{}\n".format(s) gives the same result as "%s\n" % s.