Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:20:11+00:00 2026-06-04T19:20:11+00:00

I am following the Python tutorial and at some point they talk about how

  • 0

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 Literal seems to be done with three "s, giving in the example

"""Print a Fibonacci series up to n."""

According to this documentation, this would be used mainly to create some kind of automatically produced documentation.

So I am wondering if someone here could explain to me what are these string literals exactly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:20:12+00:00Added an answer on June 4, 2026 at 7:20 pm

    What you’re talking about (I think) are called docstrings (Thanks Boud for the link).

    def foo():
        """This function does absolutely nothing"""
    

    Now, if you type help(foo) from the interpreter, you’ll get to see the string that I put in the function. You can also access that string by foo.__doc__

    Of course, string literals are just that — literal strings.

    a = "This is a string literal"  #the string on the right side is a string literal, "a" is a string variable.
    

    or

    foo("I'm passing this string literal to a function")
    

    They can be defined in a bunch of ways:

    'single quotes'
    "double quotes"
    """ triple-double quotes """  #This can contain line breaks!
    

    or even

    #This can contain line breaks too!  See?
    ''' triple-single 
        quotes '''
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following this tutorial: http://devcenter.heroku.com/articles/django At some point I'm suposed to do: pip freeze
I am starting to learn Qt4 and Python, following along some tutorial i found
I'm following the python tutorial at their site and I'm currently at the break
I have some python code for Google App Engine that responds with the string
I'm new to python and django but wanted to start following some tutorials. I
I have been learning Python by following some pygame tutorials . Therein I found
I just read the following section of the SWIG and Python tutorial: http://www.swig.org/Doc1.1/HTML/Python.html#n11 I
I'm following a tutorial in a textbook, Starting out with python 2nd edition and
I'm a newbie to python and scrapy and I'm following the dmoz tutorial. As
I'm following the tutorial from the HeadFirst Python book. In chapter 7, I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.