If you are looking for software to use, go to Huajun Software Park! software release
Location: front pageTutorial strategyTutorialComputer software tutorials How does pycharm...

How to set parameters in pycharm-How to set parameters in pycharm

Author: Qingchen Date: 2024-10-28

PyCharm
PyCharm-24.9.0.0 official version

Text editing Storage: 11.99MB Time: 2021-09-28

Software introduction: PyCharm is a Python IDE launched by JetBrains. It comes with a complete set of tools that can help users improve when developing in the Python language...

Download now

PyCharm is a software that provides powerful debugging functions, including breakpoint setting, variable monitoring, stack tracing, expression evaluation, etc. This helps developers quickly locate and resolve errors in their code. Through syntax highlighting, PyCharm can instantly display syntax errors and potential problems in the code. In addition, it also provides a code inspection function that can automatically detect and prompt potential problems in the code, such as unused variables, unsafe code patterns, etc. Next, let Huajun editor explain to you how to set parameters in pycharm and how to set parameters in pycharm!

first step

Start the PyCharm development tool. In the project view, right-click the project directory or a specific folder, select "New" -> "Python File", then name the file and confirm.

Step 2

In the newly created Python file, import the sys module. Use sys.argv to receive command line arguments. Write code to print these parameter values ​​in sequence.

Step 3

Save the Python file you wrote. Run a Python file by right-clicking on the file or clicking the Run button (usually a green triangle icon) in the editor. At this point, since no parameters are set in PyCharm, you may only see the file path printed as the first parameter.

Step 4

Press the Shift + Alt + F10 shortcut (maybe Shift + Option + F10 on macOS), or select "Run" -> "Edit Configurations..." from the menu bar.

Step 5

In the "Run/Debug Configurations" dialog box that opens, find the Python file configuration you currently want to run. In the "Parameters" field, enter the parameter values ​​you want to pass to the Python file, separating multiple parameters with spaces. For example, enter abc as parameter.

Step 6

Click "OK" to save the configuration and run the Python file again. This time, you should be able to see the parameter values ​​printed in the console, including the a, b, and c you just set in the "Parameters" field.

The above is how to set parameters in pycharm and how to set parameters in pycharm compiled by Huajun editor for you. I hope it can help you!

Related articles