'Prevent automatic escaping of backslash in strings by autopep8 in VS Code Python scripts
I have VS Code set up with the Python plugin and autopep8. My relevant settings are:
{
"editor.defaultFormatter": "ms-python.python",
"editor.formatOnSave: true,
"python.formatting.autopep8Args":[
"--agressive"
]
}
I like most of what this accomplishes with regards to auto-formatting (cutting line length, replacing the odd thing here or there) but there is one feature that is really bugging me.
I am working with pySpark and have a regexp_replace function set up as
df = df.withColumn('NewCol', regexp_replace(col('OldCol'), '\W', ' ')
When I save the file, every time, the autoformatter replaces '\W' with '\\W'. I can see why its doing it (normally, a single backslash in a string is a mistakenly un-escaped character), but in this instance, I need it to stop. Are there any arguments I can pass which ignore just this case? I dont mind it never escaping a backslash again. But I would rather not turn off --agressive correction for all the other things it achieves.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
