assigning multi-line strings to variables
cjw
cjw at ncf.ca
Wed Apr 28 09:40:53 EDT 2010
On 27-Apr-10 22:31 PM, Brendan Abel wrote:
> On Apr 27, 7:20 pm, goldtech<goldt... at worldpost.com> wrote:
>> Hi,
>>
>> This is undoubtedly a newbie question. How doI assign variables
>> multiline strings? If I try this i get what's cited below. Thanks.
>>
>>>>> d="ddddd
>> ddddd"
>>>>> d
>>
>> Traceback (most recent call last):
>> File "<interactive input>", line 1, in<module>
>> NameError: name 'd' is not defined
>
>
>
> d = "ddddddddd"\
> "ddddd"
>
> or
>
> d = "dddddddddd\
> dddddd"
>
> You don't need the trailing slash in the first example if you are
> writing this in a script, python assumes it.
What about:
*** Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit
(Intel)] on win32. ***
>>> a= ''' Now is the time for
... all good men
... to come to the aid
... of the party'''
>>> print (a)
Now is the time for
all good men
to come to the aid
of the party
>>>
Colin W.
More information about the Python-list
mailing list