Skip to content

Tag: python

Detect multi-digit numbers seperated by spaces in a string

I’m trying to write a function that returns the largest and smallest number in a string. However, not all numbers in the string are 1 digit numbers – some are 2 or 3 digits long. Examples: This exercice originates from codewars.com Answer It’s really easy to do with a list comprehension and …

Dashes with(out) spaces with python’s regex

What I’ve managed to do I’m new to both python and regex. With python’s re.compile, in massive number of text files, I wanted to find all kinds of dashes surrounded by spaces. I used: (Yeah, I know about the regex module on PyPI, but I’m trying to use what I know better) It seems to ha…

Import onnx models to tensorflow2.x?

I created a modified lenet model using tensorflow that looks like this: When I finish training I save the model using tf.keras.models.save_model : Then I transform this model into onnx format using “tf2onnx” module: I want a method that can retrieve the same model into tensorflow2.x. I tried to us…

scraping multiple tags at once

I’m trying to scrape the imdb top 250 movies and I want to get all the links of those movies from this page https://www.imdb.com/chart/top/ I tried but I’m only getting the first link only, so my question is how to scale this code to include the whole list of 250 movies? Answer bs.find(‘td&#…