Prepare string to be used in a quoted string. Turns backslash and double quote characters into quoted pairs. These are the only characters that need to be quoted inside a quoted string. Does not add the surrounding double quotes.
(str)
| 199 | |
| 200 | |
| 201 | def quote(str): |
| 202 | """Prepare string to be used in a quoted string. |
| 203 | |
| 204 | Turns backslash and double quote characters into quoted pairs. These |
| 205 | are the only characters that need to be quoted inside a quoted string. |
| 206 | Does not add the surrounding double quotes. |
| 207 | """ |
| 208 | return str.replace('\\', '\\\\').replace('"', '\\"') |
| 209 | |
| 210 | |
| 211 | class AddrlistClass: |
no test coverage detected