line to argv transformation
Antoon Pardon
antoon.pardon at rece.vub.ac.be
Mon Jun 16 06:24:47 EDT 2014
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
>>>
More information about the Python-list
mailing list