0
triple single quote,double quote? dot?
this lesson does descript the syntax, triple any strings?
2 odpowiedzi
+ 1
Triple any quotes behave as docstrings.
>>> tdq="""triple
... double
... quotes"""
>>>
>>> tdq
'triple\ndouble\nquotes'
>>> tsq='''triple single
... quotes'''
>>> tsq
'triple single\nquotes'
Dots:
>>> class boo():
... def __init__(self):
... print("init boo!")
... def method(self):
... print("class method!")
...
>>> b=boo()
init boo!
>>> b.method()
class method!
Also for class properties:
>>> import math as m
>>> m.pi
3.1415926535897931
0
Triple quotes commets things out, sing and double are the same, basically whatever you prefer is okay.