Scrapy将csv中的报废数据保存在一行而不是多行

时间:2018-02-22 12:43:01

标签: python csv xpath scrapy

我正在使用scrapy从网站中删除网址并将结果保存在csv文件中。但它只保存在一行而不是多行。我试图在stackoverflow中搜索答案但是徒劳。这是我的文件:

i want it to save like this :
    www.a.com,
    www.b.com,
    www.c.com
and not 
www.a.com,www.b.com,www.c.com

我用过:scrapy crawl uom -o uom.csv -t csv

JSON_BIGINT_AS_STRING

我的代码在哪里出错了?

1 个答案:

答案 0 :(得分:0)

您需要单独处理每个网址:

import {environment} from '../../environments/environment';
import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import VehicleModel from "../../models/vehicle.model";
import { Observable } from "rxjs/Observable";
import AppConfigService from "../appConfig.service";
import PagedResult from "../../uiComponents/datatable/types/pagedResult";

@Injectable()
export default class VehicleHTTPService {
    constructor(private http: HttpClient) { }

    getPaged(current, take): Observable<PagedResult<VehicleModel>> {

        return this.http
            .post<PagedResult<VehicleModel>>(environment.apiRoot + "/vehicle/paged", { observe: "body" });
    }
}