1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Python - How can I get a specific field of a csv file???

Discussion in 'General Scripting Chat' started by xLoKuMx, Apr 22, 2011.

  1. xLoKuMx

    xLoKuMx Jr. VIP Jr. VIP Premium Member

    Joined:
    Jun 24, 2009
    Messages:
    173
    Likes Received:
    137
    Say I have a csv file:

    Code:
    aaaaa@aaa.com,bbbbb
    ccccc@ccc.com,ddddd
    How can I get only 'ddddd' for example?

    I'm new to the language and tried some stuff with the csv module, but I don't get it... :D
     
  2. wu1239

    wu1239 Newbie

    Joined:
    Jun 4, 2011
    Messages:
    16
    Likes Received:
    0
    can you describe the problem more detail?
     
  3. seeplusplus

    seeplusplus Power Member

    Joined:
    Aug 18, 2008
    Messages:
    511
    Likes Received:
    163
    I'm clueless when it come to Python, but I would expect to create an array/vector/list and every time you come across a comma put the next segment into a new element, then if all of the ones you want are the second in the line then use array/vector/list[1] to access it.
     
  4. other_henry

    other_henry Junior Member

    Joined:
    Jun 1, 2011
    Messages:
    107
    Likes Received:
    19
    Occupation:
    Freelance coder, server guy
    Location:
    US
    The csv module isn't hard, what are you trying to do?

    If you post your code it would help us help you.