# Setting style for Python docstrings in lstinputlisting environment

I am using the listings package for source code in my LaTeX document. I am trying to set the style for docstrings in the Python programming language:

\documentclass{article}
\usepackage{listings}
\begin{document}

\lstset{
language=Python,
showstringspaces=false,
basicstyle=\ttfamily\small,
}

\begin{lstlisting}
# This is a comment
""" This is a docstring """
\end{lstlisting}

\end{document}


As you can see if you compile this code, setting the commentstyle does not change the style of docstrings. How can I set the style of docstrings?

Working from section 3.2 of the listings documentation, use the morecomment parameter to use triple quotes as delimiters:

\documentclass{article}
\usepackage{listings}
\begin{document}

\lstset{
language=Python,
showstringspaces=false,
basicstyle=\ttfamily\small,