Python标准模块——shlex
来源:互联网 发布:f22到底有多先进知乎 编辑:程序博客网 时间:2024/05/29 09:34
5、 shlex
import shlex
shlex.split(s[, comments[, posix]])
使用类似shell的语法分割字符串s,相当于特殊的tokenizer。经常用在subprocess.Popen的第一个参数中。
POSIX模式下的parser规则:
- 双引号被去掉,并且不分割单词:
>>>shlex.split('hello","word') ['hello,word']
- 非引号转义字符保留下一个字符的字面形式
- 引用符号之间的字符串保留字面形式
>>>shlex.split('hello "i am glad" word') ['hello', 'i am glad', 'word']
- 转义引用符号之间的字符串保留字面形式
>>> shlex.split('hello \"i am glad\" word') ['hello', 'i am glad', 'word']
0 0
- Python标准模块——shlex
- python shlex
- Python标准库——os模块
- Python 标准库 —— os 模块
- Python标准模块——sys
- Python标准模块——os
- Python标准模块——glob
- Python标准模块——tempfile
- Python标准模块——subprocess
- Python标准模块——PIL
- Python标准模块——xml
- Python标准模块——math
- python标准模块——time
- Python标准模块——gzip
- Python标准模块——__future__
- Python标准模块——argparse
- Python标准模块——pickle
- Python标准模块——shutil
- 隐藏单元(三)
- 54.自定义View练习(二)简易折线图控件
- 透视学理论(三)
- Tikhonov正则化和L曲线
- express 表单提交
- Python标准模块——shlex
- OSThread
- 程序设计实训报告--电子词典
- webpack优化
- Python标准模块——subprocess
- Python标准模块——PIL
- 软件工程导复习分析(简化版,不够详细,有干货)
- 快速排序
- 哈夫曼树