If you work with strings in your Python scripts and you're writing obscure logic to process them, then you need to look into ...
Reticulate is a handy way to combine Python and R code. From the reticulate help page suggests that reticulate allows for: "Calling Python from R in a variety of ways including R Markdown, sourcing ...