[Tutor] input() : part two

Servando Garcia servando at mac.com
Sat Apr 30 18:00:08 CEST 2005


Hello everyone
	Thank you for the quick response to my last request. Here is an 
update, the program I am writing takes three values from the user than 
produces the source code for another program.
THE PROBLEM:
	I needed to prompt the user for three values. I used input() like so  
M= input("Matrix=")
The IDE for Macpython works great.  It works to well, it handled the 
GUI interfaces automatically.  By using Macpython a input window was 
created for user input.  User entered code then the source code was 
generated in the output window.  I needed to redirect the output so the 
user could run the new program.  I was unable to redirect the output so 
I decided to use a terminal to run the program like this  Python 
Meta.py > comp.py  By redirecting the output the user could now run the 
program but there was problems.
	My nice input window was gone and only a blank line was present.  When 
I entered the the data the outputted file looked like this
Matrix=error=alpha

I found a work around for the terminal it appears that the message in 
the input("message")  was being assigned to the next variable making
Matrix=error=alpha
  So I created a variable with the input() blank
Matrix= input()
error= input()
alpha= input()
print Matrix
print error
print alpha

When I use the terminal to redirect the output it works fine so the 
user can now run the other program like this
Python meta.py > comp.py
python comp.py

once again thanks to everyone for the ideas. It was the brain storming 
of this group that lead me down the path I took to solve this problem
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1888 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20050430/954c042c/attachment.bin


More information about the Tutor mailing list