0

i am scraping text from a website and I'm using the strip function in python to get rid of these newlines and trailing spaces and replace all commas with space. however it doesn't do anything

            # print(predesc[0].div.p)
            itemDesc = predesc[0].div.p.text
            # itemDesc= str(itemDesc).strip("\\t\\n")
            itemDesc.strip()
            itemDesc.strip("\t")
            itemDesc.strip("\n\n")
            itemDesc.replace(",","")











            print(repr(itemDesc))```
output is
"                        Shortcut the learning curve with an all-around board that''s catch-free and easy for boosting confidence anywhere you take it.\n\nSome riders just want to get straight to the fun part. Enjoy a no-fuss feel with the Burton Instigator, a board designed to help accelerate the learning curve and instigate a good time from your first moment on the mountain. The combination of a Flat Top™ bend and Cruise Control convex base keeps things friendly underfoot, creating a catch-free feel that maintains stability and control. The Channel® mounting system gives you the easiest, most adjustable setup with bindings from all major brands (not just Burton''s). "
RileyRat5x
  • 23
  • 3

1 Answers1

0
itemDesc = itemDesc.replace('  ',' ').replace(',','').replace("''","'").replace("\n","").strip()
AlbaOpus
  • 81
  • 2