[Python] Not able to separate csv data using delimiter-"," appropriately

Discussão em 'Python' iniciado por Stack, Julho 12, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to separate csv data using the delimiter ","(comma). My data has various fields(Name,Age,Address,Amount). Some of the fields are inside double quotes("field value") like Address. When I give the delimiter as transformer.csv2xml.delimiter="," my application looks for double quotes on every field, hence unable to pull the data effectively. Whereas if I give the delimiter transformer.csv2xml.delimiter=, the application splits incorrectly the rows that have comma inside the data. Does anyone have any idea as to why it might be happening. One example I can give of this is below:

    Payment, PaymentType, Amount, Name, Address
    ABC, Wire, "$226,206.35 ", John Doe, "123 RIVERRSIDE AVE BLDG 99, 1ST FLO JACKSONVILLE FL 12345"

    Continue reading...

Compartilhe esta Página