cin
Michael P. Reilly
arcege at shore.net
Wed Jul 21 20:30:00 EDT 1999
Joacim L*wgren <fire at netlimit.com> wrote:
: Hi,
: I'm new to Python and I'm wondering what the C++ "cin" (or C
: "scanf()")equivalent in Python is. Doesn't seem there's a quick function for
: this.
Actually it is not a function, it is an operation (%).
>>> name, age = 'Michael', 30
>>> s = 'My name is %s and I am %d years old.'
>>> print s % (name, age)
My name is Michael and I am 30 years old.
Take a look at the Library Reference Manual, Section 2.1.5.1 "More String
Operations" (http://www.python.org/doc/current/lib/typesseq-strings.html).
-Arcege
More information about the Python-list
mailing list