Python Strings: Advanced Tricks and Everyday Uses (Part 2)
When you get input from users, read files, or scrape data, you’ll often end up with unwanted spaces at the start or end. strip() removes them. phrase = ” Hello, World! “print(phrase.strip()) # Output: ‘Hello, World!’ 11. Using Variables in Strings You can store text in variables and join them together:phrase = “I’m cool”print(phrase) # […]