Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.034 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'value,': 0.04; 'output': 0.05; 'friend.': 0.07; 'arguments': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.11; '"f"': 0.16; 'code?': 0.16; 'command:': 0.16; 'may"': 0.16; 'silly': 0.16; 'top-level': 0.16; 'user?': 0.16; '-the': 0.19; 'command': 0.22; 'input': 0.22; 'example': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'adds': 0.24; 'initial': 0.24; 'file.': 0.24; 'environment': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'michael': 0.29; "i'm": 0.30; 'code': 0.31; 'file:': 0.31; 'subject:that': 0.31; 'this.': 0.32; 'interface': 0.32; 'run': 0.32; 'received:209.85': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'described': 0.36; 'idle': 0.36; 'interaction': 0.36; 'next': 0.36; 'should': 0.36; 'wrong': 0.37; 'received:209': 0.37; 'clear': 0.37; 'expected': 0.38; 'ends': 0.38; 'does': 0.39; 'how': 0.40; 'john': 0.61; "you've": 0.63; 'information': 0.63; 'name': 0.63; 'different': 0.65; 'here': 0.66; 'invalid': 0.68; 'prompt': 0.68; 'saving': 0.69; 'friend': 0.79; 'friends': 0.81; "'result'": 0.84; 'nes': 0.84; 'palin': 0.84; 'shop,': 0.84; 'updated,': 0.84; 'ministry': 0.91 X-Received: by 10.49.27.102 with SMTP id s6mr1341454qeg.1.1365310851813; Sat, 06 Apr 2013 22:00:51 -0700 (PDT) Newsgroups: comp.lang.python Date: Sat, 6 Apr 2013 22:00:51 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=202.171.164.211; posting-account=Ku_GgAoAAACcsiNwXg5lFaSDSrqhcidb References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 202.171.164.211 MIME-Version: 1.0 Subject: Re: raw_input that able to do detect multiple input From: Frank To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365310861 news.xs4all.nl 6984 [2001:888:2000:d::a6]:59799 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42977 Now you've saved the data in a different file. How does the next run of=20 the program find it?=20 What user? In what environment can a user enter function calls into=20 your code?=20 -The user will call the function out from IDLE Why is the command invalid?=20 -Because the user need to type out a name after the "f" That's not the way the message is worded in the code=20 - because if user type in " a John Cleese, Cheese Shop, 5552233, 5 May" it mean it would takes four arguments (comma separated) with information=20 about a person and adds that person to my "friends.csv". An error message i= s printed if that person is already a friend. Because the name "John Cleese= " is already in my friends.csv that why it will prompt out "John Cleese is = already a friend" In this function and in save_friends, there is no return value, so not=20 clear what you mean by 'result'=20 e ends the interaction and, if the friends information has been updated, the information is saved to the friends.csv , i think i used the w= rong function for this. The question I'm told to work on: interact() is the top-level function that de=0Cnes the text-base user inter= face as described in the introduction. Here is an example of what is expected from your program. The input is everything after Command: on a line (and the initial friends.csv). Every- thing else is output. Your output should be exactly the same as below for the given input. interact()=20 Friends File: friends.csv=20 Command: f John Cleese=20 John Cleese: Ministry of Silly Walks, 5555421, 27 October=20 Command: f Michael Palin=20 Unknown friend Michael Palin=20 Command: f=20 Invalid Command: f=20 Command: a Michael Palin=20 Invalid Command: a Michael Palin=20 Command: a John Cleese, Cheese Shop, 5552233, 5 May=20 John Cleese is already a friend=20 Command: a Michael Palin, Cheese Shop, 5552233, 5 May=20 Command: f Michael Palin=20 Michael Palin: Cheese Shop, 5552233, 5 May=20 Command: e=20 Saving changes...=20 Exiting...