String escaping utility for Python (was: Rawest raw string literals)

Chris Angelico rosuav at gmail.com
Sat Apr 22 22:12:37 EDT 2017


On Sun, Apr 23, 2017 at 12:06 PM, Mikhail V <mikhailwas at gmail.com> wrote:
> Don't know, all I see is "SyntaxError: invalid syntax" if I paste
> there some text.
> Try to paste e.g. this:
> "ffmpeg -i "D:\VIDEO\exp\intro.mp4" -vf "crop=1280:720:0:40,
> scale=640:360" -pix_fmt yuv420p  "D:\ART\0MASTER_UMST\yt_pico.mp4""

Oh. I should have said that my example was for Python 3. If you're
using Python 2, use raw_input() instead. Or just switch to Python 3.

> But are you joking, right? Even if it worked, how can this be convinient,
> e.g. in console one cannot even select and copy paste easily.

Get a better console. Even in Windows, the default console is fully
capable of copying and pasting text, but you can do better than the
default. On every Linux desktop I've used, the console is beautifully
easy to use (GNOME, LXDE, Mate, Xfce, and probably a few others as
well).

> Probably one can make a python script which takes clipboard contents
> then place the conversion result back to clipboard.
> Like:
> - copy some text to clipboard
> - run the script, which replace the clipboard contents with result
> - paste text
>
> I haven't tried that, but even this would be very inconvenient and
> limited in comparison
> to a GUI utility.

You can do that too if you want to. I don't know how you'd do that
with tkinter, but it ought to be possible, and then you wouldn't need
any third party libraries.

ChrisA



More information about the Python-list mailing list