Pylint string format

Python allows you to use single or double quotes for strings. I would like to use only one quote format in my projects.

Is there any specific rule in pylint or an existing pylint plugin for this?

+3
python pylint
source share
2 answers

I recently wrote a pylint plugin for this: https://pypi.python.org/pypi/pylint-quotes

You can get it with

pip install pylint-quotes 

Then, to use it with pylint,

 pylint --load-plugins pylint_quotes <module-or-package> 

in the .pylintrc file, you can configure which quotes to use:

 # Set the linting for string quotes string-quote=single triple-quote=double docstring-quote=double 
+3
source share

I don't think pylint can do this, but there is an extension for flake8 called flake8-quotes .

+1
source share

All Articles