Skip to content
Advertisement

is there any possible way to exctract the number from dictionary by only using regex [closed]

JavaScript

need to extract only numbers by using regex in python

I try to address the numbers but I can’t i just want the number in the list

Advertisement

Answer

A regex isn’t appropriate here, but you can get all the id numbers with a simple list comprehension:

JavaScript

If what you have is a string, luckily it’s valid JSON, so use json.loads to turn it into a dictionary:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement