I am creating a function in python 3 by pulling HTML text from yahoo finance and using regular expressions so that once I enter a ticker symbol, the name of the company is returned. I am able to do so, however, when importing the company 'Macy's, Inc.', ['Macy's Inc'] is returned. Here is what I have tried so far to remove the ''' and replace it with "'":
Asked
Active
Viewed 38 times
-1
-
5Please post your code as plain text, not screenshots, so we can copy it and execute it. – Barmar Feb 21 '20 at 01:00
1 Answers
0
Use a list comprehension
return [x.replace('', "'") for x in name]
See also Decode HTML entities in Python string? for how to decode all HTML entities in a string, not just 
.

Barmar
- 741,623
- 53
- 500
- 612