Raw Input Question

mackstann mack at incise.org
Tue Aug 26 22:40:39 EDT 2003


On Tue, Aug 26, 2003 at 10:33:36PM -0400, hokiegal99 wrote:
> How can I pass the content of one varible into raw_input? See below for 
> what I'm trying to do:
> 
> XXX = raw_input("1. Enter the string that you'd like to find: ")
> y = raw_input("2. Enter the string that you'd like to replace XXX with: ")
> 
> I'm trying to pass x into y. I tried the "Enter the string that you'd 
> like to replace", XXX, "with:" approach, but Pyhton told me that I could 
> only pass 1 argument, no more.

Ah, you are confusing print's behavior for general string concatenation.
I believe what you want to do is:

y = raw_input("2. Enter the string that you'd like to replace "+XXX+" with:")

or

y = raw_input("2. Enter the string that you'd like to replace %s with:" % XXX)

-- 
m a c k s t a n n  mack @ incise.org  http://incise.org
As the poet said, "Only God can make a tree" -- probably because it's
so hard to figure out how to get the bark on.
		-- Woody Allen





More information about the Python-list mailing list