Hello together,
sorry for my bad english.

I'm complete new to python and its very difficult for me, so i hope that you can help me.

i have got a csv in which there are names and telephone numbers. Now i have to do an program that shows me the telephone number of the person i enter.

i would start like this. is this okay? How do i go on?

Datei = open("Handylist.csv", "r")
Datei.readlines()

name = raw_input("Enter the name")

Please help me.

It would generally be something in this ballpark

file_pointer = open("Handylist.csv", "r")

name_in = raw_input("Enter the name")
for rec in file_pointer:
    substrs = rec.split()
    name = substrs[x]   ## don't know where this is
    if name == name_in:
        print("%s Found" % (name))

Thank you, but this doesn't work. I already tried in this and similar ways. he always doesn't find ne name in the list although its inside.
Do i have to put the names in a list and the numbers in a list and add them to a dictionary. How does this work?

Or has anybody an other idee?

file_pointer = open("Handylist.csv", "r")
name_in = raw_input("Enter the name")
for rec in file_pointer:
substrs = rec.split()
name = substrs[x] ## don't know where this is
if name == name_in:
print("%s Found",% (name))

u have to put comma

Edited 6 Years Ago by fubhasan: n/a

file_pointer = open("Handylist.csv", "r")
name_in = raw_input("Enter the name")
for rec in file_pointer:
substrs = rec.split()
name = substrs[x] ## don't know where this is
if name == name_in:
print("%s Found",% (name))

u have to put comma

Let's not be silly, there is no comma needed in print("%s Found",% (name))

basti!, you got to give us a few lines of your csv file.

Edited 6 Years Ago by vegaseat: n/a

This article has been dead for over six months. Start a new discussion instead.