Not sure if this is a bug, or if the technique for dealing with such paths is simply obscure. Note: This is a Mac OS X environment, but that said, the GUI has never had a problem dealing with this character on a day-to-day basis, and usually, if there's going to be a syntax problem in the Terminal, Apple does a pretty good job of disabling the behavior in the GUI. `date` (in fact, I had a bear of a time even writing the latter in SE MD syntax.) but this is unrelated to the ENV or any script. There is no need to try to escape backslashes. py.exe hello.py 'test(1).txt' gets passed to WinAPI CreateProcessW as py.exe hello.py 'test(1).txt'. PowerShell and WSL accommodate this by translating single-quote strings to double-quote strings in a command line, e.g. I know the "new" rule is to use a syntax like export NOW=$(date) vs export NOW= MSVC argv and WinAPI CommandLineToArgvW only support double-quote strings. Yet if I try the logical solution ↯ # scp -r dns.local:/\`Downloads/CrazyRussianCars/ ~/īash: -c: line 0: unexpected EOF while looking for matching ``'īash: -c: line 1: syntax error: unexpected end of file Note that Black also uses double quotes for Python’s triple-quoted, multiline strings 3. The string for variable d retains its original single quotes to avoid escaping any double quotes within the string 2. for example ↯ # scp -r dns.local:/`Downloads/CrazyRussianCars/ ~/ Notice that the strings for variables a, b, and c use double quotes. If I try to run a command, calling the file unescaped ↝ it kicks me into an interactive session. It works nicely, except when I go to access these files via the CLI or SSH/SCP. If the quotes you want to strip are always going to be 'first and last' as you said, then you could simply use: The one below is safer If you can't assume that all the strings you process have double quotes you can use something like this: if string.startswith (''') and string. Replace all single quotes that are where the double quotes in JSON should be, with double quotes, using the regex given above. I tend to prefix oft-used files and folders with the "accent grave" character (non-shift tilde, the back-tick, or plain-old accent, whathaveyou.), as it is easy to get at, and let's me sort things alphabetically, while letting me choose to show a few items on the top. Replace all (leftover) double quotes with some special character that does not feature in your document, e.g.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |