What is the proper way to comment functions in Python?

前端 未结 10 1595
情书的邮戳
情书的邮戳 2021-01-30 01:58

Is there a generally accepted way to comment functions in Python? Is the following acceptable?

#########################################################
# Create         


        
10条回答
  •  北荒
    北荒 (楼主)
    2021-01-30 02:42

    You can use three quotes to do it.

    You can use single quotes:

    def myfunction(para1,para2):
      '''
      The stuff inside the function
      '''
    

    Or double quotes:

    def myfunction(para1,para2):
      """
      The stuff inside the function
      """
    

提交回复
热议问题