-2

hello i hope someone can help me with this issue so i trying to scrapp iframe tag in a web page but i get some backslashes which i want to remove

i select the element

video=soup_product.select_one("div.col-lg-6:nth-of-type(3)>iframe")

and this is printing result :

<iframe allowfullscreen=\"\" frameborder=\"0\" height=\"170\" src=\"https://www.youtube.com/embed/JwG10b9HtZQ\" width=\"305\"></iframe>

i tried too replace the backslash with replace function

str(video).replace('\', '')

but it show error

File "", line 2 videoiframe = str(video).replace("", "") ^ SyntaxError: EOL while scanning string literal

1 Answers1

0

Escape the backslash as well

str(video).replace('\\', '')
Driftr95
  • 4,572
  • 2
  • 9
  • 21