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

Newsgroups comp.lang.python
Date 2013-04-06 22:00 -0700
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>
Subject Re: raw_input that able to do detect multiple input
From Frank <jiewei24@gmail.com>
Message-ID <mailman.230.1365310861.3114.python-list@python.org> (permalink)

Show all headers | 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