Python_pycharm Debug mode + use Pycharm to pass parameters to Python

Source: Internet
Author: User

One. Pass function 1 to Python via Pycharm. Write the parameters to get in the Pycharm terminal, get 1 start pycharm in the Terminal (Terminal) window click on the icon in the lower left corner of the pycharm, select Terminal  2 "in tests.py write the following code #/ usr/bin/python#coding=utf-8# @Time   : 2017/10/12 20:37# @Auther: liuzhenchuan# @File   : tests.py# print ' A ' import sys     print (sys.argv[0]) print (sys.argv[1])   3 "with tets.py get ' The hello ' parameter executes "python tests.py hello" in tests.py cmd,: tests.py      #tests. Py by sys.argv[0 ] gets to. 0 get to the program itself path hello           # Hello by sys.argv[1] get to    2. Set the fixed parameters to get in Pycharm, get 1 tests.py press ALT+SHIFT+F10  ----Select Edit configuration (edit configurations)---script parameters (script). As shown in:  Click Run, the first parameter gets to the absolute path of the script, and the second parameter gets to the ' Liuzhenchuan ' Note: To get multiple parameters, write multiple print (sys.argv[x]) in tests.py. In Pycharm also write the corresponding parameter number, as follows: Import Sys     print (sys.argv[0]) print (sys.argv[1]) print ( SYS.ARGV[2])    "ALT + Shift +F10"---Edit configuration---Script parameters---set two parameters   liuzhenchuan   Hello click Run:   two. Pycharm debug mode  pycharm debug mode (Breakpoint Debug mode), Also called debug mode 1. Set breakpoints: Before the code, after the line number, you can set breakpoints by clicking the mouse. as follows:  2. Debug Breakpoint (SHFIT+F9): Click on the green Beetle icon (it appears that the beetle has become a debug-only icon), and when you click on a breakpoint, it will run to the first breakpoint. The variable information before the breakpoint is displayed. Click Step Over or press F8, we continue to run down to the next breakpoint:  . F7: Jumps to the next method, reads the statement in the method  . F8: Read each statement, jump to the next breakpoint   three. Extend the function of partial Vim+python auto-completionhttp://www.jianshu.com/p/f0513d18742a

Python_pycharm Debug mode + use Pycharm to pass parameters to Python

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.