Hi all, I would require advise on this question for function call interact:
the desire outcome: interact() Friends File: friends.csv Command: f John Cleese John Cleese: Ministry of Silly Walks, 5555421, 27 October Command: f Michael Palin Unknown friend Michael Palin Command: f Invalid Command: f Command: a Michael Palin Invalid Command: a Michael Palin Command: a John Cleese, Cheese Shop, 5552233, 5 May John Cleese is already a friend Command: a Michael Palin, Cheese Shop, 5552233, 5 May Command: f Michael Palin Michael Palin: Cheese Shop, 5552233, 5 May Command: e Saving changes... Exiting... my code so far for interact: #interact function def interact(*arg): open('friends.csv', 'rU') d = load_friends('friends.csv') print "Friends File: friends.csv" s = raw_input("Please input something: ") command = s.split(" ", 1) if "f" in command: display_friends("command",load_friends('friends.csv')) print command #display friend function def display_friends(name, friends_list): Fname = name[0] for item in friends_list: if item[0] == Fname: print item break else: print False Let say if i type in " f John Cleese " and after the line 6 , my value of "command" should be ['f', 'John Cleese']. Is there ways to extract out John Cleese as a input so that i could use it on my function call "display_friends" ? -- http://mail.python.org/mailman/listinfo/python-list