I understand that for quotation marks ` is required to open a quote, however I am listing a long code copied over from Python where some comments are written 'comment' or """comment""". Is there an easy way to make the quotation marks at the start of a comment appear the right way around without manually changing them all?
My LaTeX is roughly as follows:
\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[language=Python, showstringspaces=false, breaklines = true]
"""comment 1"""
'comment 2'
directory=input('apostrophes also appear in code sometimes: ')
\end{lstlisting}
\end{document}
\lstinputlisting) for"""or'at the start of a line. – Marijn Apr 30 '18 at 22:08