samedi 27 août 2016

Can a line of Python code know its indentation nesting level?

From something like this:

print(get_indentation_level())

    print(get_indentation_level())

        print(get_indentation_level())

I would like to get something like this:

1
2
3

Can the code read itself in this way?





Aucun commentaire:

Enregistrer un commentaire