This tutorial explains how to change and configure the Maximum line length in PyCharm IDE.
Let’s a variable declared with a string value and line length is 154 characters.
The code editor throws an underlined warning
PEP 8: E501 line too long (154 > 120 characters) as per the given screenshot.
How to fix PEP 8: E501 line too long warning
Pycharm IDE is similar to Intelli IDE, So the Default Line line is 120 characters per line in both editors.
Sometimes we want to limit or increase the number of characters per line.
PyCharm uses a PEP8 checker to check a given line length and throws a warning if the length is more than 120 characters.
To remove the PEP8 E501 warning, You have to configure the below steps to ignore this warning and
- Open PyCharm editor, and open or create a Project
- Open the
Filemenu and Select
Settings, Settings window shown to the user
Editor, and Select the
- Shows list of options, Select Python and select
PEP8 coding style violation
+Button on ignore errors
- It shows the entered input text box and enter the
E501value and click on the
![pycharm settings PEP8 coding style violation](/images/editors/pycharm/ pycharm-python-pep8-e501.png)
- Now, the warning is resolved and not shown to the user.
How to limit the maximum length of characters in a line
In Code editor, if the line length is more than 120 characters, It shows a Vertical line as given below.
Let’s see how to change the line length to 80 characters from the default 120 characters.
- Open File Menu, Select Settings, and Settings window shown to the user
Code Styleson the Right margin option
- Enter values for
- Hard Wrap to 80
- Visual Guides for wrapping to 80
- Check on
Wrap on Typing
- Finally, Save it.
- Next select Other file types under the child element of the