Show More
@@ -162,6 +162,18 def samestat(s1, s2): | |||
|
162 | 162 | _quotere = None |
|
163 | 163 | _needsshellquote = None |
|
164 | 164 | def shellquote(s): |
|
165 | r""" | |
|
166 | >>> shellquote(r'C:\Users\xyz') | |
|
167 | '"C:\\Users\\xyz"' | |
|
168 | >>> shellquote(r'C:\Users\xyz/mixed') | |
|
169 | '"C:\\Users\\xyz/mixed"' | |
|
170 | >>> # Would be safe not to quote too, since it is all double backslashes | |
|
171 | >>> shellquote(r'C:\\Users\\xyz') | |
|
172 | '"C:\\\\Users\\\\xyz"' | |
|
173 | >>> # But this must be quoted | |
|
174 | >>> shellquote(r'C:\\Users\\xyz/abc') | |
|
175 | '"C:\\\\Users\\\\xyz/abc"' | |
|
176 | """ | |
|
165 | 177 | global _quotere |
|
166 | 178 | if _quotere is None: |
|
167 | 179 | _quotere = re.compile(r'(\\*)("|\\$)') |
General Comments 0
You need to be logged in to leave comments.
Login now