Docstrings have an interesting characteristic in that they can span multiple lines (other programming languages use the name “heredoc” for the same concept). Even though you can use """ or ''' to surround your docstrings, most Python programmers prefer to use """. In Python, strings can be enclosed in a single quote character ( '), a double quote character ( "), or what’s known as triple quotes ( """ or ''').Īs mentioned earlier, triple quotes around strings are known as docstrings, because they are mainly used to document a function’s purpose (as shown above). Understanding the string quote characters
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |