A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-April/034675.html below:

[Python-Dev] shellwords

[Python-Dev] shellwordsGustavo Niemeyer niemeyer@conectiva.com
Wed, 16 Apr 2003 12:29:44 -0300
> Can shlex not be convinced to do what you want?  (Yes, I saw your Q/A, but
> didn't quite understand it.)

Oh, sorry. Just now I noticed that you didn't *understand* it.

He was talking about that:

>>> s = StringIO.StringIO("foo 'bar'asd'foo'")
>>> l = shlex.shlex(s)
>>> l.
l.__class__     l.error_leader  l.pop_source    l.source
l.__doc__       l.filestack     l.push_source   l.sourcehook
l.__init__      l.get_token     l.push_token    l.state
l.__module__    l.infile        l.pushback      l.token
l.commenters    l.instream      l.quotes        l.whitespace
l.debug         l.lineno        l.read_token    l.wordchars
>>> l.read_token()
'foo'
>>> l.read_token()
"'bar'"
>>> l.read_token()
"asd'foo'"
>>> 


In constrast to:

>>> shellwords.shellwords("foo 'bar'asd'foo'")
['foo', 'barasdfoo']

And also:

[niemeyer@localhost ~/src]% echo foo 'bar'asd'foo' 
foo barasdfoo

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4