Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54930
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <daniel.stjnv@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | UNSURE 0.259 |
| X-Spam-Level | ** |
| X-Spam-Evidence | '*H*': 0.50; '*S*': 0.02; 'import': 0.22; 'print': 0.22; 'second': 0.26; 'message-id:@mail.gmail.com': 0.30; 'this.': 0.32; 'subject:from': 0.34; 'received:google.com': 0.35; 'depends': 0.38; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'previous': 0.38; 'explain': 0.39; 'reported': 0.39; 'to:addr:python.org': 0.39; 'tell': 0.60; 'first': 0.61; 'popped': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=oGTyrDWF5uWK/UzOj7KiZSKpkL9obyC57YKg/+HwOks=; b=xhElRxkzrFa3jzMpW0DQZf6ww7i38DkFbo5QAogBgexMr8NT/MYONYRBqMZ3gd1y7a rhUXqgHf2lgsk4Z1RIC+L3VXzZx/cskqSerp4rv3kCDlleFJ5xKgnq3JBeXS8DZAF/X3 x5rIAEOupgykKTj9hxKHZWkmUHsc7YZkae22Ynmx0iwBQWUVfTRZEGlYHqoqFA5lghvL THw2whTXRaATEeEjSIKW9LHaiLhA3o3mZUlMvE5yFEr2a107xs0N1f0HWoxtqvIHHHMq 6nUhMVWI2QHst0HdDJm647hwceb5APwdtTHcexUSuOOvDMlGMo+MGaMGcVrW27TObMnJ YuHw== |
| MIME-Version | 1.0 |
| X-Received | by 10.180.185.166 with SMTP id fd6mr5583207wic.5.1380349584928; Fri, 27 Sep 2013 23:26:24 -0700 (PDT) |
| Date | Sat, 28 Sep 2013 16:26:24 +1000 |
| Subject | Weird bahaviour from shlex - line no |
| From | Daniel Stojanov <daniel.stjnv@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Mailman-Approved-At | Sat, 28 Sep 2013 08:55:29 +0200 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.404.1380351331.18130.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380351331 news.xs4all.nl 15892 [2001:888:2000:d::a6]:57174 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:54930 |
Show key headers only | View raw
Can somebody explain this. The line number reported by shlex depends
on the previous token. I want to be able to tell if I have just popped
the last token on a line.
import shlex
first = shlex.shlex("word1 word2\nword3")
print first.get_token()
print first.get_token()
print "line no", first.lineno, "\n"
second = shlex.shlex("word1 word2,\nword3")
print second.get_token()
print second.get_token()
print second.get_token()
print "line no", second.lineno, "\n"
OUTPUT:
word1
word2
line no 2
word1
word2
,
line no 1
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Weird bahaviour from shlex - line no Daniel Stojanov <daniel.stjnv@gmail.com> - 2013-09-28 16:26 +1000
csiph-web