Modifying numeric values scraped from website

Hello,

I am building a simple webscraper to take information from a website and modify said information.

In this situation, I am scraping a recipe and taking the ingredients. One of said ingredients is:
“3 ½ to 4 pound beef chuck roast”

However, I cannot get python to recognize that 3 ½ is equal to 3 1/2 or 3.5

What code can be used to make it understand?

You can use the python Fractions library. Here is an example Fraction module in Python | GeeksforGeeks. Here is another example that fits your use case better


it is from python - How can fractional number expressions be parsed using pyparsing? - Stack Overflow