Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42977

Re: raw_input that able to do detect multiple input

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 <jiewei24@gmail.com>
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 <mailman.229.1365309396.3114.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=202.171.164.211; posting-account=Ku_GgAoAAACcsiNwXg5lFaSDSrqhcidb
References <cb34034e-8cd5-400b-9b71-7d365326d289@googlegroups.com> <mailman.220.1365298909.3114.python-list@python.org> <ad79c95a-8cbd-4e6e-bc93-b23e4c11ab94@googlegroups.com> <mailman.229.1365309396.3114.python-list@python.org>
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 <jiewei24@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.230.1365310861.3114.python-list@python.org> (permalink)
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

Show key headers only | View raw


Now you've saved the data in a different file.  How does the next run of 
the program find it? 


What user?  In what environment can a user enter function calls into 
your code? 
-The user will call the function out from IDLE

Why is the command invalid? 
-Because the user need to type out a name after the "f"

That's not the way the message is worded in the code 
- because if user type in " a John Cleese, Cheese Shop, 5552233, 5 May"
it mean it would takes four arguments (comma separated) with information 
about a person and adds that person to my "friends.csv". An error message is 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 
clear what you mean by  'result' 

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 wrong function for this.

The question I'm told to work on:
interact() is the top-level function that denes the text-base user interface
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() 
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...

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

raw_input that able to do detect multiple input Frank <jiewei24@gmail.com> - 2013-04-06 18:03 -0700
  Re: raw_input that able to do detect multiple input Dave Angel <davea@davea.name> - 2013-04-06 21:41 -0400
    Re: raw_input that able to do detect multiple input Frank <jiewei24@gmail.com> - 2013-04-06 20:22 -0700
      Re: raw_input that able to do detect multiple input Dave Angel <davea@davea.name> - 2013-04-07 00:36 -0400
        Re: raw_input that able to do detect multiple input Frank <jiewei24@gmail.com> - 2013-04-06 22:00 -0700
          Re: raw_input that able to do detect multiple input Dave Angel <davea@davea.name> - 2013-04-07 01:25 -0400
        Re: raw_input that able to do detect multiple input Frank <jiewei24@gmail.com> - 2013-04-06 22:00 -0700
    Re: raw_input that able to do detect multiple input Frank <jiewei24@gmail.com> - 2013-04-06 20:22 -0700

csiph-web