single-quoted string conversion to triple-quoted string

Cliff Wells logiplexsoftware at earthlink.net
Fri Apr 5 19:08:59 EST 2002


On Sat, 06 Apr 2002 00:05:58 GMT
robin and jim wrote:

> Is there a way to convert a single quoted string to a triple quoted string?
> 
> For example, given:
> 
> ''' abc %d xyz '''
> 
> the result of ''' abc %d xyz''' % 10 is:
> 
> ' abc 10 xyz '
> 
> which is a single quoted string.
> 
> I would like to convert the result to a triple-quoted string.

What do you mean?  What is the difference between single- and triple-quotes in
this context?  

Python 2.2 (#1, Mar 15 2002, 11:52:42) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> """hello"""
'hello'
>>> "hello"
'hello'
>>> 

As you can see, the results are the same (a string).  Perhaps if you give an
idea of what you are trying to do...

-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308





More information about the Python-list mailing list