79828598

Date: 2025-11-24 12:08:17
Score: 3
Natty:
Report link

(Side-note: maybe I shouldn't have classified this question as "Best Practices"? I can't figure out how to add an actual answer to the question.)

Thanks to @Randommm for the pointer. I adapted this answer to work with multi-line, sometimes indented contents:

subprocess.call([
    "vim",
    "-c", ":set paste",
    "-c", f':exe "normal i{contents}\\<Esc>"',
    "-c", ":set nopaste",
    filename
])  
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Contains signature (1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @Randommm
  • Self-answer (0.5):
Posted by: Ted