In this article, we will be discussing formatting files in the user’s workspace by using their extension. We will be using Clang tools for achieving this in Python for data science.
Pre- Requirements: Python, Linux machine, and clang tool.
- First, we will install Python using the command given below.
- Then we will install clang tools.
- Next, we will create a Python file named format-code.py at a location having reading and writing permissions. The code is as follows.
- Next, we will be creating a format specification file and copy it to the project’s top-level directory.
We have created google coding style tool here.
Then we have copied it to the project directory so, its location will become:
Using the program:
- First, we will navigate to the directory whose files we want to format
- Next, we will run the format code we have created earlier.