String question

Nathan Froyd froydnj at rose-hulman.edu
Wed Feb 16 21:20:30 CET 2000


In article <88ev6m$cun$1 at news.uit.no>, Runar Olsen wrote:
>I want the variable 'string' to be a string and not a list..
>>>> n =10
>>>> string = "n = ", n
>>>> print string
>('n = ', 10)
>
>I want string to be "n = 10". How?

Like this:

Python 1.5.1 (#1, May  6 1998, 01:48:27)  [GCC 2.7.2.3] on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> n = 10
>>> string = "n = " + str(n)
>>> print string
n = 10
-- 
</nathan><sig>froydnj at rose-hulman.edu  |  http://www.rose-hulman.edu/~froydnj/

...you could spend *all day* customizing the title bar. Believe me. I speak
from experience. --Matt Welsh                                           </sig>



More information about the Python-list mailing list