mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
- Changed shlex.split() method to have more useful and
meaningful parameters.
This commit is contained in:
parent
cf146d31e7
commit
48f3dcc93e
3 changed files with 13 additions and 16 deletions
|
@ -271,9 +271,11 @@ class shlex:
|
|||
raise StopIteration
|
||||
return token
|
||||
|
||||
def split(s, posix=True, spaces=True):
|
||||
lex = shlex(s, posix=posix)
|
||||
lex.whitespace_split = spaces
|
||||
def split(s, comments=False):
|
||||
lex = shlex(s, posix=True)
|
||||
lex.whitespace_split = True
|
||||
if not comments:
|
||||
lex.commenters = ''
|
||||
return list(lex)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue