How to automatically get the indent level from code?

Rodrick Brown rodrick.brown at gmail.com
Sun Mar 17 06:34:05 CET 2013


No


On Sun, Mar 17, 2013 at 12:52 AM, Peng Yu <pengyu.ut at gmail.com> wrote:

> Hi,
>
> I want to get the indent level within the code. For example, I want to
> print 1 within the while loop as the line is indented 1 level. Is it
> possible to get it within python?
>
> while 1:
>    #print the level of indent, which is 1 here.
>
> --
> Regards,
> Peng
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130317/170d0edc/attachment.html>


More information about the Python-list mailing list