assigning multi-line strings to variables
MRAB
python at mrabarnett.plus.com
Tue Apr 27 22:33:51 EDT 2010
goldtech 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
Use a triple-quoted string literal:
>>> d = """ddddd
... ddddd"""
>>> d
'ddddd\nddddd'
More information about the Python-list
mailing list