Open In App

PyCharm Code Styling

Last Updated : 08 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

PyCharm is one of the most famous and most used Python Code Editor. PyCharm is a popular integrated development environment (IDE) created by JetBrains specifically designed for Python development. It provides a comprehensive set of tools and features that make it easier for developers to write, debug, and maintain Python code efficiently. In this article, we will see how we can configure the style of code in PyCharm.

Configure the Style of Code in PyCharm

Below are the steps by which we can configure the style of code in Pycharm:

Step 1: Open PyCharm

Launch PyCharm on your Computer and open the project in which you want to configure the code style.

Step 2: Access Code Style Setting

Goto file -> Setting (or PyCharm > Preferences on macOS) to open setting.

one-(1)-(1)

Step 3: Configure Code Style

In the setting Dialog box, click on “Editor” options -> click “Code Style” options

two-(1)-(1)

First Click on “Editor” then click on “Code style”.

Step 4: Expand the code style tab

Expand the code style tab by clicking on the highlighted option.

three-(1)-(1)

Step 5: Choose the Language

Now you will see the list of Programming languages. Now select any option on which you want to configure code Style.

four-(1)-(1)

Choose any file for which you want to configure code style.

Step 6: Customize code style Options

Now after selection of programming language. you get a various tab for configuring code style and you can configure it as per your choice and requirement.

fifth-(1)-(1)

Step 7: Apply and Save Changes

Make the desired changes to the code style setting. Once you’re modified your desired code style setting, click the “Apply” and “OK” buttons to save the changes.

Ex :- Here I’m going to change my indent size from 4 to 8.

six-(1)-(1)

After modifying the code style first click on “Apply” then press “OK”.

Step 8: Reformat Code

After configuring the code styling setting you have to reformat you code with the help of PyCharm code formatting feature. This can be done easily, Select the code you want to format and then using the “Reformat Code” command (often found under the “Code” menu).

seven-(1)-(1)

After Reformatting Code the changes in the code style done by you will reflect on your editor.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads