Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41347

How to automatically get the indent level from code?

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <pengyu.ut@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.033
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'subject:code': 0.07; 'subject:How': 0.09; '#print': 0.09; 'subject:skip:a 10': 0.09; 'indent': 0.16; 'code.': 0.20; 'python?': 0.20; 'message- id:@mail.gmail.com': 0.27; 'print': 0.32; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'received:google.com': 0.34; 'subject:?': 0.35; 'received:209.85': 0.35; 'level.': 0.36; 'possible': 0.37; 'level': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'to:addr:python.org': 0.39; 'within': 0.64; 'subject:get': 0.81
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=0HxjIdGoz4pHQjdLLbklTCdQmyIqzzqXt9f0y+nJs54=; b=nWsowKHpo/j3ul+pMnPpoWoWorDY04x4o18EZh/p9ad/2EkIm5QrBpRnoKI3pcDB02 nMfKa/xYKyyAzZHGYKXMr3xmXpJon0Muy6o2RHd/mZcEZF0hetJgjriJtIUuje+GzLm1 L06lcMliCrztkqM2Q5ueW1g6mNjgKBVh4NDY8hU/zuCBwTrqOjWAJexI3CPs0U66Dj3T RVzkvlQZzWS3buRWEE/6WmMzIZBWZUZsLoigLFIAOn3h7milxKpSKHHrQz/WKLUy/IWd LFPjD9Hz/jHkVKxhngJb+jxoDPmzlmHVKVfgED8xFjYj6n115C7iYbk62k8w9GF3KQe9 Cl0w==
MIME-Version 1.0
X-Received by 10.49.108.104 with SMTP id hj8mr15711835qeb.4.1363495962464; Sat, 16 Mar 2013 21:52:42 -0700 (PDT)
Date Sat, 16 Mar 2013 23:52:42 -0500
Subject How to automatically get the indent level from code?
From Peng Yu <pengyu.ut@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3382.1363495970.2939.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363495970 news.xs4all.nl 6885 [2001:888:2000:d::a6]:39152
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41347

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

How to automatically get the indent level from code? Peng Yu <pengyu.ut@gmail.com> - 2013-03-16 23:52 -0500

csiph-web