Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73309
| Date | 2014-06-16 12:24 +0200 |
|---|---|
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
| Subject | Re: line to argv transformation |
| References | <539EBF61.4050106@rece.vub.ac.be> <CAPTjJmqd74v013WwG2QrZP2y9N+gMk0TK5xT5-yy3=8gOuAs4g@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11081.1402914290.18130.python-list@python.org> (permalink) |
On 16-06-14 12:06, Chris Angelico wrote:
> def shell_split(cmd):
> return subprocess.check_output("""python -c 'import sys;
> print("\\0".join(sys.argv[1:]))' """+cmd,shell=True)[:-1].split("\0")
Nice idea, unfortunatly it doesn't work in python3.3
>>> shell_split("ls *.py")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in shell_split
TypeError: Type str doesn't support the buffer API
>>>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: line to argv transformation Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-06-16 12:24 +0200
csiph-web