From: Joern E. <Joe...@mi...> - 2001-07-20 16:33:38
|
> Joern Eckhoff wrote: > > > > ... > > Or any hint how to convert an INT to a > > STRING without using this intricately solution? > > Why can't you just use the back-quotes?: > > >>> a=123 > >>> print 'test' + `a` > test123 > >>> > > (the BACK-Quotes are below the tilde '~' on my keyboard). > __o > Jim Adrig _ \<,_ MY computer says: >>> a=123 >>> print 'test'+'a' testa >>> _ :-( ... *truncate* ... eeerm, one moment, please ... >>> a=123 >>> print 'test'+`a` test123 >>> _ Bin-GO! Exactly that's what I wanted. Thank you very much - weekend's saved. But at my computer the back-quotes are above the ~ (1st left from backspace) and have to be used in this way: 1. press [shift] and hold it 2. press the quote one time (nothing happens) 3. press space (the backquote appears) Misterious, misterious, ... But the import doesn't work at all now. Next rescuer, please. :-) Yours sincerely, Joern |
From: D-Man <ds...@ri...> - 2001-07-20 18:42:20
|
On Fri, Jul 20, 2001 at 06:31:37PM +0200, Joern Eckhoff wrote: | > Joern Eckhoff wrote: | > > | > > ... | > > Or any hint how to convert an INT to a | > > STRING without using this intricately solution? | > | > Why can't you just use the back-quotes?: | > | > >>> a=123 | > >>> print 'test' + `a` | > test123 | > >>> | > | > (the BACK-Quotes are below the tilde '~' on my keyboard). | | MY computer says: | | >>> a=123 | >>> print 'test'+'a' | testa | >>> _ | | :-( Yeah, with single quotes not backquotes :-). | ... *truncate* ... eeerm, one moment, please ... | | >>> a=123 | >>> print 'test'+`a` | test123 | >>> _ FYI, the backquotes call str() (or is it repr()? They are very similar anyways). So the following is identical, but slightly more verbose : >>> a=123 >>> print 'test' + str( a ) test123 >>> -D |