python调试利器pysnooper实践使用分析

       任何编程实践中,都避免不了出现错误或者其他的问题,那么测试和调试程序就成为了解决错误很重要的一个环节了,在Python项目中,大多数的错误都是通过一步一步的print定位查找、解决的。这是我之前最为常用的方法,那么有没有更好的或者是更加方便,高大上的方法帮助我们去调试程序呢?答案是有的。

      听说pysnooper很久了,一直没有时间来用一用,今天正好还有点时间就想着拿过来体验一下,感受这个不需要再使用print就可以达到跟使用了print同样效果的调试工具怎么样,好了,闲话不多说了,这里进入正题。

     实践内容是很简单的,具体如下:

#!usr/bin/env python
#encoding:utf-8
from __future__ import division

'''
__Author__:沂水寒城
功能: Python 调试工具 pysnooper 实践
       PySnooper允许你执行以上相同的操作,只需为要调试的函数添加一个
       装饰器即可,而不需要构建正确的 print 打印。你还将得到函数的详细
       日志,包括运行了哪些代码行、何时运行以及何时更改了局部变量。
       PySnooper 使用起来十分简单,开发者可以在任何庞大的代码库中使用它,
       而无需进行任何设置。你只需添加装饰器,并为日志输出地址指定路径,
       方法是将其路径指定为第一个参数。
'''


import random
import pysnooper



@pysnooper.snoop('out.log')
def number_to_bits(number):
    '''
    二进制化
    '''
    if number:
        bits = []
        while number:
            number, remainder = divmod(number, 2)
            bits.insert(0, remainder)
        return bits
    else:
        return [0]


@pysnooper.snoop('output.log')
def generateRandomNums(num=1000):
    '''
    生成指定数量的随机数,返回排序后的结果
    '''
    res_list=[]
    for i in range(num):
        res_list.append(random.randint(0,999999999))
    return sorted(res_list)



if __name__=='__main__':
    number_to_bits(6)
    generateRandomNums(num=1000)

       我在上述的程序中,给出来了两个函数实例,第一个函数是拿来坐着的原始实例没有去做改动,我们这里只需要对原始的程序加入一个装饰器就可以了,参数表示的意思是结果和日志信息保存的文件路径,如果不提供的话就会直接在终端输出所有的信息,我这里都提供了保存的文件名,方便重复查看。

       使用的思想很简单,相关的注释也都在代码中了,就不多说了,这里看一下结果文件内容。

out.log

Starting var:.. number = 6
19:19:54.951000 call        23 def number_to_bits(number):
19:19:54.952000 line        24     if number:
19:19:54.953000 line        25         bits = []
New var:....... bits = []
19:19:54.953000 line        26         while number:
19:19:54.953000 line        27             number, remainder = divmod(number, 2)
Modified var:.. number = 3
New var:....... remainder = 0
19:19:54.954000 line        28             bits.insert(0, remainder)
Modified var:.. bits = [0]
19:19:54.954000 line        26         while number:
19:19:54.955000 line        27             number, remainder = divmod(number, 2)
Modified var:.. number = 1
Modified var:.. remainder = 1
19:19:54.955000 line        28             bits.insert(0, remainder)
Modified var:.. bits = [1, 0]
19:19:54.956000 line        26         while number:
19:19:54.956000 line        27             number, remainder = divmod(number, 2)
Modified var:.. number = 0
19:19:54.956000 line        28             bits.insert(0, remainder)
Modified var:.. bits = [1, 1, 0]
19:19:54.957000 line        26         while number:
19:19:54.957000 line        29         return bits
19:19:54.957000 return      29         return bits
Return value:.. [1, 1, 0]

     output.log

Starting var:.. num = 100
19:29:46.477000 call        35 def generateRandomNums(num=1000):
19:29:46.479000 line        39     res_list=[]
New var:....... res_list = []
19:29:46.480000 line        40     for i in range(num):
New var:....... i = 0
19:29:46.480000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006]
19:29:46.481000 line        40     for i in range(num):
Modified var:.. i = 1
19:29:46.482000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932]
19:29:46.482000 line        40     for i in range(num):
Modified var:.. i = 2
19:29:46.483000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010]
19:29:46.484000 line        40     for i in range(num):
Modified var:.. i = 3
19:29:46.484000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507]
19:29:46.485000 line        40     for i in range(num):
Modified var:.. i = 4
19:29:46.485000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938537380]
19:29:46.486000 line        40     for i in range(num):
Modified var:.. i = 5
19:29:46.486000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938537380, 531733831]
19:29:46.487000 line        40     for i in range(num):
Modified var:.. i = 6
19:29:46.487000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938537380, 531733831, 925352504]
19:29:46.488000 line        40     for i in range(num):
Modified var:.. i = 7
19:29:46.488000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938537380, 531733831, 925352504, 613602783]
19:29:46.489000 line        40     for i in range(num):
Modified var:.. i = 8
19:29:46.490000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938537380, 531733831, 925352504, 613602783, 564448613]
19:29:46.490000 line        40     for i in range(num):
Modified var:.. i = 9
19:29:46.491000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...3831, 925352504, 613602783, 564448613, 633568543]
19:29:46.491000 line        40     for i in range(num):
Modified var:.. i = 10
19:29:46.491000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...2504, 613602783, 564448613, 633568543, 361086575]
19:29:46.492000 line        40     for i in range(num):
Modified var:.. i = 11
19:29:46.492000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...2783, 564448613, 633568543, 361086575, 730035537]
19:29:46.493000 line        40     for i in range(num):
Modified var:.. i = 12
19:29:46.493000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...8613, 633568543, 361086575, 730035537, 696152701]
19:29:46.493000 line        40     for i in range(num):
Modified var:.. i = 13
19:29:46.494000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...8543, 361086575, 730035537, 696152701, 222186298]
19:29:46.494000 line        40     for i in range(num):
Modified var:.. i = 14
19:29:46.495000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...6575, 730035537, 696152701, 222186298, 430344169]
19:29:46.495000 line        40     for i in range(num):
Modified var:.. i = 15
19:29:46.496000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...5537, 696152701, 222186298, 430344169, 790986733]
19:29:46.497000 line        40     for i in range(num):
Modified var:.. i = 16
19:29:46.497000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...2701, 222186298, 430344169, 790986733, 579986345]
19:29:46.498000 line        40     for i in range(num):
Modified var:.. i = 17
19:29:46.498000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...6298, 430344169, 790986733, 579986345, 138990338]
19:29:46.498000 line        40     for i in range(num):
Modified var:.. i = 18
19:29:46.499000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...4169, 790986733, 579986345, 138990338, 691443115]
19:29:46.499000 line        40     for i in range(num):
Modified var:.. i = 19
19:29:46.500000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...6733, 579986345, 138990338, 691443115, 355575434]
19:29:46.500000 line        40     for i in range(num):
Modified var:.. i = 20
19:29:46.500000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...6345, 138990338, 691443115, 355575434, 448673465]
19:29:46.501000 line        40     for i in range(num):
Modified var:.. i = 21
19:29:46.501000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...0338, 691443115, 355575434, 448673465, 496403824]
19:29:46.502000 line        40     for i in range(num):
Modified var:.. i = 22
19:29:46.502000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...3115, 355575434, 448673465, 496403824, 179081873]
19:29:46.502000 line        40     for i in range(num):
Modified var:.. i = 23
19:29:46.503000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...5434, 448673465, 496403824, 179081873, 788989379]
19:29:46.503000 line        40     for i in range(num):
Modified var:.. i = 24
19:29:46.504000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...3465, 496403824, 179081873, 788989379, 942257759]
19:29:46.504000 line        40     for i in range(num):
Modified var:.. i = 25
19:29:46.504000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...3824, 179081873, 788989379, 942257759, 749793758]
19:29:46.505000 line        40     for i in range(num):
Modified var:.. i = 26
19:29:46.505000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...1873, 788989379, 942257759, 749793758, 355614751]
19:29:46.505000 line        40     for i in range(num):
Modified var:.. i = 27
19:29:46.506000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...9379, 942257759, 749793758, 355614751, 459122078]
19:29:46.506000 line        40     for i in range(num):
Modified var:.. i = 28
19:29:46.507000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...7759, 749793758, 355614751, 459122078, 627232468]
19:29:46.507000 line        40     for i in range(num):
Modified var:.. i = 29
19:29:46.507000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...3758, 355614751, 459122078, 627232468, 737292955]
19:29:46.508000 line        40     for i in range(num):
Modified var:.. i = 30
19:29:46.508000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...4751, 459122078, 627232468, 737292955, 334667674]
19:29:46.509000 line        40     for i in range(num):
Modified var:.. i = 31
19:29:46.509000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...2078, 627232468, 737292955, 334667674, 734275281]
19:29:46.509000 line        40     for i in range(num):
Modified var:.. i = 32
19:29:46.510000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...2468, 737292955, 334667674, 734275281, 493778443]
19:29:46.510000 line        40     for i in range(num):
Modified var:.. i = 33
19:29:46.511000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...2955, 334667674, 734275281, 493778443, 479380104]
19:29:46.511000 line        40     for i in range(num):
Modified var:.. i = 34
19:29:46.511000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...7674, 734275281, 493778443, 479380104, 212184455]
19:29:46.512000 line        40     for i in range(num):
Modified var:.. i = 35
19:29:46.512000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...5281, 493778443, 479380104, 212184455, 687313807]
19:29:46.513000 line        40     for i in range(num):
Modified var:.. i = 36
19:29:46.513000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...8443, 479380104, 212184455, 687313807, 712713384]
19:29:46.513000 line        40     for i in range(num):
Modified var:.. i = 37
19:29:46.514000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...0104, 212184455, 687313807, 712713384, 421398509]
19:29:46.514000 line        40     for i in range(num):
Modified var:.. i = 38
19:29:46.515000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...4455, 687313807, 712713384, 421398509, 850200438]
19:29:46.515000 line        40     for i in range(num):
Modified var:.. i = 39
19:29:46.516000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...3807, 712713384, 421398509, 850200438, 996938315]
19:29:46.516000 line        40     for i in range(num):
Modified var:.. i = 40
19:29:46.517000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...3384, 421398509, 850200438, 996938315, 128635757]
19:29:46.517000 line        40     for i in range(num):
Modified var:.. i = 41
19:29:46.517000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...8509, 850200438, 996938315, 128635757, 814179881]
19:29:46.518000 line        40     for i in range(num):
Modified var:.. i = 42
19:29:46.518000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...0438, 996938315, 128635757, 814179881, 226573267]
19:29:46.519000 line        40     for i in range(num):
Modified var:.. i = 43
19:29:46.519000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...8315, 128635757, 814179881, 226573267, 181346723]
19:29:46.519000 line        40     for i in range(num):
Modified var:.. i = 44
19:29:46.520000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...5757, 814179881, 226573267, 181346723, 577154439]
19:29:46.521000 line        40     for i in range(num):
Modified var:.. i = 45
19:29:46.523000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...9881, 226573267, 181346723, 577154439, 981985025]
19:29:46.523000 line        40     for i in range(num):
Modified var:.. i = 46
19:29:46.524000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...3267, 181346723, 577154439, 981985025, 577639639]
19:29:46.524000 line        40     for i in range(num):
Modified var:.. i = 47
19:29:46.525000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...6723, 577154439, 981985025, 577639639, 261471198]
19:29:46.525000 line        40     for i in range(num):
Modified var:.. i = 48
19:29:46.526000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...4439, 981985025, 577639639, 261471198, 145951818]
19:29:46.526000 line        40     for i in range(num):
Modified var:.. i = 49
19:29:46.527000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...5025, 577639639, 261471198, 145951818, 126002855]
19:29:46.527000 line        40     for i in range(num):
Modified var:.. i = 50
19:29:46.528000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...9639, 261471198, 145951818, 126002855, 894251451]
19:29:46.528000 line        40     for i in range(num):
Modified var:.. i = 51
19:29:46.529000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...1198, 145951818, 126002855, 894251451, 633815693]
19:29:46.529000 line        40     for i in range(num):
Modified var:.. i = 52
19:29:46.529000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...51818, 126002855, 894251451, 633815693, 27626424]
19:29:46.530000 line        40     for i in range(num):
Modified var:.. i = 53
19:29:46.531000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...02855, 894251451, 633815693, 27626424, 954169523]
19:29:46.531000 line        40     for i in range(num):
Modified var:.. i = 54
19:29:46.539000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...51451, 633815693, 27626424, 954169523, 289022523]
19:29:46.540000 line        40     for i in range(num):
Modified var:.. i = 55
19:29:46.541000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...15693, 27626424, 954169523, 289022523, 483248177]
19:29:46.541000 line        40     for i in range(num):
Modified var:.. i = 56
19:29:46.542000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...6424, 954169523, 289022523, 483248177, 966799516]
19:29:46.543000 line        40     for i in range(num):
Modified var:.. i = 57
19:29:46.543000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...9523, 289022523, 483248177, 966799516, 513037427]
19:29:46.544000 line        40     for i in range(num):
Modified var:.. i = 58
19:29:46.544000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...2523, 483248177, 966799516, 513037427, 244284589]
19:29:46.545000 line        40     for i in range(num):
Modified var:.. i = 59
19:29:46.545000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...8177, 966799516, 513037427, 244284589, 324205570]
19:29:46.546000 line        40     for i in range(num):
Modified var:.. i = 60
19:29:46.546000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...9516, 513037427, 244284589, 324205570, 237911374]
19:29:46.547000 line        40     for i in range(num):
Modified var:.. i = 61
19:29:46.547000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...7427, 244284589, 324205570, 237911374, 482242828]
19:29:46.547000 line        40     for i in range(num):
Modified var:.. i = 62
19:29:46.548000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...4589, 324205570, 237911374, 482242828, 783775312]
19:29:46.548000 line        40     for i in range(num):
Modified var:.. i = 63
19:29:46.549000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...5570, 237911374, 482242828, 783775312, 400225768]
19:29:46.549000 line        40     for i in range(num):
Modified var:.. i = 64
19:29:46.550000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...1374, 482242828, 783775312, 400225768, 427464444]
19:29:46.550000 line        40     for i in range(num):
Modified var:.. i = 65
19:29:46.550000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...2828, 783775312, 400225768, 427464444, 480287737]
19:29:46.551000 line        40     for i in range(num):
Modified var:.. i = 66
19:29:46.551000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...5312, 400225768, 427464444, 480287737, 758709125]
19:29:46.552000 line        40     for i in range(num):
Modified var:.. i = 67
19:29:46.552000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...5768, 427464444, 480287737, 758709125, 401938881]
19:29:46.552000 line        40     for i in range(num):
Modified var:.. i = 68
19:29:46.553000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...4444, 480287737, 758709125, 401938881, 268720889]
19:29:46.553000 line        40     for i in range(num):
Modified var:.. i = 69
19:29:46.554000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...7737, 758709125, 401938881, 268720889, 772369477]
19:29:46.554000 line        40     for i in range(num):
Modified var:.. i = 70
19:29:46.554000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...9125, 401938881, 268720889, 772369477, 272524022]
19:29:46.555000 line        40     for i in range(num):
Modified var:.. i = 71
19:29:46.555000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...8881, 268720889, 772369477, 272524022, 354554285]
19:29:46.556000 line        40     for i in range(num):
Modified var:.. i = 72
19:29:46.556000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...0889, 772369477, 272524022, 354554285, 790063240]
19:29:46.557000 line        40     for i in range(num):
Modified var:.. i = 73
19:29:46.557000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...369477, 272524022, 354554285, 790063240, 3361715]
19:29:46.557000 line        40     for i in range(num):
Modified var:.. i = 74
19:29:46.558000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...524022, 354554285, 790063240, 3361715, 816708524]
19:29:46.558000 line        40     for i in range(num):
Modified var:.. i = 75
19:29:46.558000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...554285, 790063240, 3361715, 816708524, 961279798]
19:29:46.559000 line        40     for i in range(num):
Modified var:.. i = 76
19:29:46.559000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...063240, 3361715, 816708524, 961279798, 661434759]
19:29:46.560000 line        40     for i in range(num):
Modified var:.. i = 77
19:29:46.563000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...1715, 816708524, 961279798, 661434759, 450750048]
19:29:46.563000 line        40     for i in range(num):
Modified var:.. i = 78
19:29:46.564000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...08524, 961279798, 661434759, 450750048, 39747160]
19:29:46.564000 line        40     for i in range(num):
Modified var:.. i = 79
19:29:46.565000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...79798, 661434759, 450750048, 39747160, 484989423]
19:29:46.565000 line        40     for i in range(num):
Modified var:.. i = 80
19:29:46.566000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...34759, 450750048, 39747160, 484989423, 928321584]
19:29:46.566000 line        40     for i in range(num):
Modified var:.. i = 81
19:29:46.566000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...750048, 39747160, 484989423, 928321584, 74753540]
19:29:46.567000 line        40     for i in range(num):
Modified var:.. i = 82
19:29:46.567000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...747160, 484989423, 928321584, 74753540, 44793088]
19:29:46.568000 line        40     for i in range(num):
Modified var:.. i = 83
19:29:46.568000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...4989423, 928321584, 74753540, 44793088, 12731477]
19:29:46.569000 line        40     for i in range(num):
Modified var:.. i = 84
19:29:46.569000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...8321584, 74753540, 44793088, 12731477, 251177710]
19:29:46.569000 line        40     for i in range(num):
Modified var:.. i = 85
19:29:46.570000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...753540, 44793088, 12731477, 251177710, 813922954]
19:29:46.570000 line        40     for i in range(num):
Modified var:.. i = 86
19:29:46.571000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...93088, 12731477, 251177710, 813922954, 212118665]
19:29:46.571000 line        40     for i in range(num):
Modified var:.. i = 87
19:29:46.572000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...1477, 251177710, 813922954, 212118665, 429661371]
19:29:46.572000 line        40     for i in range(num):
Modified var:.. i = 88
19:29:46.572000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...7710, 813922954, 212118665, 429661371, 239992027]
19:29:46.573000 line        40     for i in range(num):
Modified var:.. i = 89
19:29:46.573000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...2954, 212118665, 429661371, 239992027, 729912379]
19:29:46.574000 line        40     for i in range(num):
Modified var:.. i = 90
19:29:46.574000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...8665, 429661371, 239992027, 729912379, 413663127]
19:29:46.574000 line        40     for i in range(num):
Modified var:.. i = 91
19:29:46.575000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...1371, 239992027, 729912379, 413663127, 380487661]
19:29:46.575000 line        40     for i in range(num):
Modified var:.. i = 92
19:29:46.576000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...92027, 729912379, 413663127, 380487661, 67612519]
19:29:46.576000 line        40     for i in range(num):
Modified var:.. i = 93
19:29:46.576000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...12379, 413663127, 380487661, 67612519, 735692660]
19:29:46.577000 line        40     for i in range(num):
Modified var:.. i = 94
19:29:46.577000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...63127, 380487661, 67612519, 735692660, 967376267]
19:29:46.578000 line        40     for i in range(num):
Modified var:.. i = 95
19:29:46.578000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...487661, 67612519, 735692660, 967376267, 50485172]
19:29:46.579000 line        40     for i in range(num):
Modified var:.. i = 96
19:29:46.579000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...12519, 735692660, 967376267, 50485172, 452514235]
19:29:46.580000 line        40     for i in range(num):
Modified var:.. i = 97
19:29:46.580000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...92660, 967376267, 50485172, 452514235, 547998308]
19:29:46.581000 line        40     for i in range(num):
Modified var:.. i = 98
19:29:46.581000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...76267, 50485172, 452514235, 547998308, 807414205]
19:29:46.581000 line        40     for i in range(num):
Modified var:.. i = 99
19:29:46.582000 line        41         res_list.append(random.randint(0,999999999))
Modified var:.. res_list = [411723006, 861043932, 794746010, 941572507, 938...5172, 452514235, 547998308, 807414205, 167652398]
19:29:46.582000 line        40     for i in range(num):
19:29:46.583000 line        42     return sorted(res_list)
19:29:46.583000 return      42     return sorted(res_list)
Return value:.. [3361715, 12731477, 27626424, 39747160, 44793088...9798, 966799516, 967376267, 981985025, 996938315]

        从文件内容来看,每一次的执行都有详细的说明,这个对于调试来说是很有帮助的,之后的项目可以尝试使用一下哈!

已标记关键词 清除标记
相关推荐
【为什么还需要学习C++?】 你是否接触很多语言,但从来没有了解过编程语言的本质? 你是否想成为一名资深开发人员,想开发别人做不了的高性能程序? 你是否经常想要窥探大型企业级开发工程的思路,但苦于没有基础只能望洋兴叹?   那么C++就是你个人能力提升,职业之路进阶的不二之选。 【课程特色】 1.课程共19大章节,239课时内容,涵盖数据结构、函数、类、指针、标准库全部知识体系。 2.带你从知识与思想的层面从0构建C++知识框架,分析大型项目实践思路,为你打下坚实的基础。 3.李宁老师结合4大国外顶级C++著作的精华为大家推出的《征服C++11》课程。 【学完后我将达到什么水平?】 1.对C++的各个知识能够熟练配置、开发、部署; 2.吊打一切关于C++的笔试面试题; 3.面向物联网的“嵌入式”和面向大型化的“分布式”开发,掌握职业钥匙,把握行业先机。 【面向人群】 1.希望一站式快速入门的C++初学者; 2.希望快速学习 C++、掌握编程要义、修炼内功的开发者; 3.有志于挑战更高级的开发项目,成为资深开发的工程师。 【课程设计】 本课程包含3大模块 基础篇 本篇主要讲解c++的基础概念,包含数据类型、运算符等基本语法,数组、指针、字符串等基本词法,循环、函数、类等基本句法等。 进阶篇 本篇主要讲解编程中常用的一些技能,包含类的高级技术、类的继承、编译链接和命名空间等。 提升篇: 本篇可以帮助学员更加高效的进行c++开发,其中包含类型转换、文件操作、异常处理、代码重用等内容。
©️2020 CSDN 皮肤主题: 护眼 设计师:闪电赇 返回首页
实付 19.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值