Triple quoted string in exec function ?

Stef Mientki stef.mientki at gmail.com
Tue Dec 30 15:16:39 EST 2008


ibpet11 at gmail.com wrote:
> On Dec 30, 2:48 pm, Steve Holden <st... at holdenweb.com> wrote:
>   
>> Stef Mientki wrote:
>>     
>>> hello,
>>>       
>>> I'm running scripts, with the execute function (Python 2.5),
>>> and it seems that triple quoted strings are not allowed.
>>>       
>>> Is there a workaround,
>>> or is this a fundamental problem of the exec-function ?
>>>       
>> If you think about it, it should be obvious that you can't surround a
>> string to be compiled with any of the quotes that appear inside the
>> string to be compiled. That's about the only limitation I am aware of.
>>
>> And, by the way, exec is a *statement*, not a function!
>>     
      exec ( Init_Code, PG.P_Globals )

I've really doubt that this is a statement,
unless I don't understand what a statement is.
>>     
>>>>> exec """print '''This is
>>>>>           
>> ... a long string'''
>> ... """
>> This is
>> a long string
>>
>>
>>
>> regards
>>  Steve
>> --
>> Steve Holden        +1 571 484 6266   +1 800 494 3119
>> Holden Web LLC              http://www.holdenweb.com/
>>     
>
> hello,
> the message Steven sent you is ok to explain how to work with triple
> quote
>
>   
Yes, but not to work around my problem.
I guess I've to remove all triple quoted strings from my code.

anyway thanks,
Stef




More information about the Python-list mailing list