String literal with triple quotes in function definitions

后端 未结 6 1255
陌清茗
陌清茗 2020-12-04 15:41

I am following the Python tutorial and at some point they talk about how the 1st statement of a function can be a String Literal. As far as the example goes, this String Lit

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 15:51

    A string literal is simply a string given literally in the source code. Whether it is a docstring or another string does not matter. See the Python language documentation section on string literals for all the details, but you probably don't need these details now.

    A few examples:

    "abc"
    'Guido'
    r"""Norwegian Blue"""
    

提交回复
热议问题