looking for data on csv files

Discussion in 'Python' started by flit, Aug 28, 2006.

  1. flit

    flit Guest

    Hi!
    I am using the csv modules..

    when I use the command:

    if nome in row[rowcsv]:
    print "\n"
    print row[rowcsv] + "\n ----> " + row[11] + "\n"
    print
    "################################################################"

    there is this case:

    1- data on file PUItarr

    If the user try to find for puitarr or PUITARR it doesn´t find.

    I tried the string.upper and .lower , but there is a a way to look far
    all possible combinations?

    And yes, i am a newbie..
     
    flit, Aug 28, 2006
    #1
    1. Advertising

  2. flit

    faulkner Guest

    import re
    if re.search(nome, row[rowcsv], re.I):
    ...

    that's re.I [capital i] as in ignorecase.

    flit wrote:
    > Hi!
    > I am using the csv modules..
    >
    > when I use the command:
    >
    > if nome in row[rowcsv]:
    > print "\n"
    > print row[rowcsv] + "\n ----> " + row[11] + "\n"
    > print
    > "################################################################"
    >
    > there is this case:
    >
    > 1- data on file PUItarr
    >
    > If the user try to find for puitarr or PUITARR it doesn´t find.
    >
    > I tried the string.upper and .lower , but there is a a way to look far
    > all possible combinations?
    >
    > And yes, i am a newbie..
     
    faulkner, Aug 28, 2006
    #2
    1. Advertising

  3. flit a écrit :
    > Hi!
    > I am using the csv modules..
    >
    > when I use the command:
    >
    > if nome in row[rowcsv]:
    > print "\n"
    > print row[rowcsv] + "\n ----> " + row[11] + "\n"
    > print
    > "################################################################"


    Python 2.4.1 (#1, Jul 23 2005, 00:37:37)
    [GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)] on
    linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> if nome in row[rowcsv]:

    .... print "\n"
    .... print row[rowcsv] + "\n ----> " + row[11] + "\n"
    .... print
    ....
    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    NameError: name 'nome' is not defined

    Not enough code to reproduce your problem. Please post the minimal
    snippet reproducing your problem.

    > there is this case:
    >
    > 1- data on file PUItarr
    >
    > If the user try to find for puitarr or PUITARR it doesn´t find.
    >
    > I tried the string.upper and .lower , but there is a a way to look far
    > all possible combinations?


    Probably.

    > And yes, i am a newbie..


    Don't worry - we've all been newbies.
     
    Bruno Desthuilliers, Aug 28, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sugapablo
    Replies:
    1
    Views:
    496
    Chris F.A. Johnson
    Jul 3, 2005
  2. Michal Mikolajczyk
    Replies:
    0
    Views:
    673
    Michal Mikolajczyk
    Feb 13, 2004
  3. Skip Montanaro
    Replies:
    0
    Views:
    742
    Skip Montanaro
    Feb 13, 2004
  4. Tintin92
    Replies:
    1
    Views:
    1,750
    Andrew Thompson
    Feb 14, 2007
  5. jliu66
    Replies:
    0
    Views:
    527
    jliu66
    Oct 19, 2007
Loading...

Share This Page