Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

extract digits with serten lenth from string python

import re

str = 'We four guys, live at 2nd street of Malibeu 521. I had a cash of $248 in my pocket. I got a ticket with serial number 88796451-52.'

#search using regex
x = re.findall('[0-9]+', str)
print('All Numbers
',x)

#digits of length N
N=3

def filterNumber(n):
	if(len(n)==N):
		return True
	else:
		return False
		
#filter the list
finalx = list(filter(filterNumber, x))
print('Final List
',finalx)
Comment

PREVIOUS NEXT
Code Example
Typescript :: run a python module with imports from parent 
Typescript :: typescript public function 
Typescript :: ngx-numeral 
Typescript :: typescript `is a` function determine type 
Typescript :: flutter too many positional arguments 0 expected but 1 found 
Typescript :: Building a maven EAR project and specifying the configuration of which projects to include, what is the element in the plugin configuration that contains Enterprise Java Bean Projects: 
Typescript :: highcharts print 
Typescript :: why are inline scripts not working anymore on HTML 
Typescript :: how to convert an array of other types in java 8 
Typescript :: typescript -g doesnst read tsconfog 
Typescript :: when should you stop testing 
Typescript :: studying for a sceince test 
Typescript :: how can you run your test in different environments 
Typescript :: nextjs waiting for compiling problem 
Typescript :: how to loop through a specific number of elements in a list python 
Typescript :: whats the extension of a markup language 
Typescript :: Creates new angular app 
Typescript :: typescript programmatically union 
Typescript :: what do brackets mean in python 
Typescript :: constraints in database 
Typescript :: css animation for beginners 
Typescript :: ring Composition and Returning Objects and Lists by Reference 
Typescript :: Which one of these is an ideal method to separate sand and salt from water? 
Typescript :: typescript cast to parent type 
Typescript :: loadsh partial match filter 
Typescript :: typescript make every property of an object nullable 
Typescript :: mkdir windows 
Typescript :: React/Typescript Storybook not allowing objects to be imported 
Typescript :: re initialize weights keras 
Typescript :: post data 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =