Thứ Bảy, 2 tháng 3, 2019

How to dump a object in Python dont need import extra lib?

The equivalent var_dump(object) of PHP: combile print with vars

print(vars(object1),vars(object2))

Using pdb with Django

from django.http import HttpResponse


def default(request):
    # completely innocuous variables
    foo = 1
    bar = 0
    # completely innocuous division
    ni = foo/bar
    return HttpResponse("Foo says %d" % ni, mimetype="text/plain")

enter image description here


Reactions: