Tags: style blog class code java cFirst, PDB useThe PDB is a Python-brought package that provides an interactive source code debugging feature for Python programs, including setting breakpoints, stepping through debugging, entering function debugging, viewing current code, viewing stack fragments, dynamically changing
The functionality of the Idel ribbon that used to be used under Windows has been debugged by the Python program, which has not been debugged under Linux. (many times just print) to find out from the Internet ~
Method:Copy the Code code as follows:
PYTHON-M PDB a.py
a.py is a python file.
Common commands in (
Simple Debug Python ProgramYou can also debug a program in Python like Gcc/gdb, as long as the PDB module is introduced when you run the Python program (assuming that the program you are debugging is named d.py):$ VI d.py#!/usr/bin/pythondef Main (): i, sum = 1, 0 for I in xrange (+): sum =
Tags: ext file set table Python newpython-m pdb myscript.py #注意这会重启myscript. pyYou can set breakpoints like this in your program:Import PDB; Pdb.set_trace ()You can modify the value of a variable, but be aware that it is preceded by! For example, to modify the final value, this should!final= "NewValue"Supported commands:P Print VariablesN NextStep Fine Point oper
execution of a try clause, the remainder of the try clause is ignored. If the type of the exception matches the name after except, then the corresponding except clause is executed. The code after the last try statement is executed.
If an exception does not match any of the except, then the exception is passed to the upper try.
A try statement may contain multiple except clauses that handle different specific exceptions. Only one branch will be executed at most. Finally will be execute
Overview
Python comes with pdb to debug code.
Set breakpoints
import
pdb
...
pdb.set_trace()
....
Common commands
Set a breakpoint for break or B
Set breakpoints
Continue or c
Continue Program Execution
List or l
View the code segment of the current row
Step or s
Go to function
Return or r
Run the co
Tags: matlab break open Command Window here space enter PDF TLA execute gesBefore always said to learn python can still stay in the view of the level, yesterday, the great God hand to teach me the PDB debugging, said to get rid of IDE integrated development environment programming, thank you, a Flag,python must get started! 1, enter the way 1) under Windows cmd o
Lptrace is essentially GDB-based, enters the process memory space, and executes a python command to print out the trace at the time.Use tool: Https://github.com/khamidou/lptrace1, Linux is very simple:InstallationYum Install GDBPip Install LptraceUse:[emailprotected]:/vagrant$ python -m SimpleHTTPServer 8080 [1] 1818[emailprotected]:/vagrant$ Serving HTTP on 0.0.
46965125#quote from ' Introduction to computation and programming #using Python, revised, MIT Press ' import Randomimport Pylab def s Tddev (x): mean = SUM (x)/len (x) tot = 0.0 for X in X:tot + = (X-mean) **2 return (Tot/len (x)) **0.5 def CV (x): mean = SUM (x)/len (x) return StdDev (x)/mean class Location (object): Def __init__ (self, x, y): "" "X and Y is floats" "" self.x = x self.y = y def move (self, deltax, DeltaY): "" "DeltaX A
Tagged with: trace attributionNeither Windows nor Linux system Traceroute commands can show attribution, and in actual network maintenance, the attribution addresses of these trace routes are also important information to help us locate where the problem occurs. The following is a script written by Python to show the place of attribution. Also convenient for thei
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.