Find the best tutors and institutes for Programming Languages

Find Best Programming Languages Classes

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Search for topics

Programming Languages Updates

Ask a Question

Post a Lesson

All

All

Lessons

Discussion

Lesson Posted 1 day ago IT Courses/Programming Languages/Python

Using Lambda and Filter with Regular expressions.

Michael Devine

I can teach every topic very easily and make it stronger for the students.

1) Start the Python interpreter and import the re module: >>> import re 2)Define a tuple strings to filter with regular expressions: t=('python','pycon','perl','peril','step','stop','come','came','exercise','hello','storm','my.mail','year','yam') 3) The 'Lambda' will execute the 'match'... read more

1) Start the Python interpreter and import the re module:

>>> import re

 

2)Define a tuple strings to filter with regular expressions:

t=('python','pycon','perl','peril','step','stop','come','came','exercise','hello','storm','my.mail','year','yam')

 

3) The 'Lambda' will execute the 'match' on each element of the tuple. A match matches only if found at the beginning. If the return of the 'match' is 'true' is collected in the 'Filter' object.

>>> a=filter(lambda i:re.match(r'py',i),t)
>>> print(*a)
python pycon
>>>

>>> 

>>> a=filter(lambda i:re.match(r'st',i),t)
>>> print(*a)
step stop
>>>

>>> a=filter(lambda i:re.match(r'me',i),t) 
>>> a
<filter object at 0x044203F0>

>>> list(a)
[]
>>> print(*a)

 

>>> 

4) To find strings anywhere in the input, use re.search:

>>> a=filter(lambda i:re.search(r'me',i),t)
>>> print(*a)
come came
>>> a=filter(lambda i:re.search(r'o',i),t) 
>>> print(*a)
python pycon stop come hello
>>>

 5) Use for the period (dot) for 'any character':

>>> a=filter(lambda i:re.search(r'c.m',i),t)
>>> print(*a)
come came
>>>

>>> a=filter(lambda i:re.search(r'st.',i),t)
>>> print(*a)
step stop
>>>

>>> a=filter(lambda i:re.search(r'y.m',i),t)
>>> print(*a)
my.mail yam
>>>

 

6) match only the period (by escaping the special character):

>>> a=filter(lambda i:re.search(r'y\.m',i),t)
>>> print(*a)
my.mail
>>>

 

7)  search for any number of repeating characters by using the asterisk, which can match a series of whatever character is in front of it:

>>> a=filter(lambda i:re.search(r'y.*',i),t)
>>>
>>> print(*a)
python pycon my.mail year yam
>>>

 

8) The * matches zero or more occurrences of a character between two z’s. The + matches at least one or more characters:

>>> a=filter(lambda i:re.search(r'l.*',i),t)
>>> print(*a)
perl peril hello my.mail
>>> a=filter(lambda i:re.search(r'l.*l',i),t)
>>> print(*a)
hello
>>> a=filter(lambda i:re.search(r'l.+l',i),t)
>>> print(*a)

>>>

 

9) Now you know how to match anything with, say, a ‘ c ’ in it:

>>> a=filter(lambda i:re.search(r'c+',i),t)
>>> print(*a)
pycon come came exercise
>>>

 

10) How would you match anything without a ‘ c ’ ? Regular expressions use square brackets to denote special sets of characters to match, and if there’s a caret at the beginning of the list, it means any string that has a character that isn’t the specified character in the set, so:

>>> a=filter(lambda i:re.search(r'[^c]',i),t)
>>> print(*a)
python pycon perl peril step stop come came exercise hello storm my.mail year yam
>>> a=filter(lambda i:re.search(r'[^c]*',i),t)
>>> print(*a)
python pycon perl peril step stop come came exercise hello storm my.mail year yam
>>> a=filter(lambda i:re.search(r'[^c]+',i),t)
>>> print(*a)
python pycon perl peril step stop come came exercise hello storm my.mail year yam

 

11) To match any string without a ‘ c ’ in it, you have to use the ^ and $ special characters to refer to the beginning and end of the string and then tell re that you want strings composed only of non - c characters from beginning to end:

>>> a=filter(lambda i:re.search(r'^[^c]*$',i),t)
>>> print(*a)
python perl peril step stop hello storm my.mail year yam
>>>

read less
Comments
Dislike Bookmark

Answered 2 days ago IT Courses/Programming Languages/Python

What should I do after learning Python?

Michael Devine

After learning the Basics and Intermediate level of programming with Python, you should pursue the next level of usage of Python. However, you can get a job and simultaniously learn advanced Python in particular domains like 'data science', 'cloud', 'Testing automation', 'iot', 'big data' etc thereby... read more

After learning the Basics and Intermediate level of programming with Python, you should pursue the next level of usage of Python. However, you can get a job and simultaniously learn advanced Python in particular domains like 'data science', 'cloud', 'Testing automation', 'iot', 'big data' etc thereby extending your skill set.

read less
Answers 1 Comments
Dislike Bookmark

Answered 2 days ago IT Courses/Programming Languages/Python

Why is Python so popular despite being so slow?

Michael Devine

It's not 'so slow'. It is popular mainly because it is easy to learn and scale up. It is readable and easily understandable thereby better maintainability. It is powerfull and loc is lesser. Lots of support available for usage in different domains. It is open source yet administered well. The speed of... read more

It's not 'so slow'. It is popular mainly because it is easy to learn and scale up. It is readable and easily understandable thereby better maintainability. It is powerfull and loc is lesser. Lots of support available for usage in different domains. It is open source yet administered well. The speed of execution is marginally less than certain other languages but Python can be speeded up to almost the speed of 'C' by using certain techniques if necessary.

read less
Answers 1 Comments
Dislike Bookmark

Looking for Programming Languages Classes

Find best Programming Languages Classes in your locality on UrbanPro.

FIND NOW

Answered 2 days ago IT Courses/Programming Languages/Python

Why do Python Devs type: if __name__ == '__main__': main()? Isn't it pretty useless?

Michael Devine

definations if __name__ == '__main__': implementation statements This is block included in modules that contain definations of functions and class types, so that, the implementation statements for testing these definations may be executed on condition that the executing program is the... read more

definations

if __name__ == '__main__':

         implementation statements

 

This is block included in modules that contain definations of functions and class types, so that, the implementation statements for testing these definations may be executed on condition that the executing program is the module itself (__name__ == '__main__':). 

If the module was imported and executed from another program, then the condition will not be satisfied and the implementation statements will be suppressed.

 

**This is wondeful feature of Python that enables nesting of modules without worrying about the danger of local implementation statements in the module getting executed in the importing program.

read less
Answers 1 Comments
Dislike Bookmark

Answered 2 days ago IT Courses/Programming Languages/Python

What is pickling and unpickling in Python?

Sapan Sharma

Senior Data Scientist

pickling and unpickling mean serializing (and deserializing) python objects in order to store them in filesystem for later use. What this means in common language is if you have large object like a large dictionary or a data table that you would want to use after the current python process is cleared... read more

pickling and unpickling mean serializing (and deserializing) python objects in order to store them in filesystem for later use. What this means in common language is if you have large object like a large dictionary or a data table that you would want to use after the current python process is cleared from the RAM, the next time without again populating the object through code, you can simply convert them into lightweight objects( that python takes a very small time to process and hence make your program run faster over multiple iterations) and store them on the hard disk.

read less
Answers 1 Comments
Dislike Bookmark

Answered 2 days ago IT Courses/Programming Languages/Python

Which is the best Python training institute in Bangalore?

Michael Devine

The best training institute is the one who will, on completion of the course, have given you a skill to be fluent with programming in python at the corporate level so that it will be easy to get great job offers and successfully crack job interviews. When you go for councelling, make sure you get a written... read more

The best training institute is the one who will, on completion of the course, have given you a skill to be fluent with programming in python at the corporate level so that it will be easy to get great job offers and successfully crack job interviews. When you go for councelling, make sure you get a written guarantee for the above. Make sure there are lots of exercises, hands on assignments, interview questions and solutions provided.

read less
Answers 1 Comments
Dislike Bookmark

Looking for Programming Languages Classes

Find best Programming Languages Classes in your locality on UrbanPro.

FIND NOW

Answered 2 days ago IT Courses/Programming Languages/Python

Which is the best institute for Python training in Bangalore - Edureka, myTectra, or Simplilearn?

Michael Devine

The best training institute is the one who will, on completion of the course, have given you a skill to be fluent with programming in python at the corporate level so that it will be easy to get great job offers and successfully crack job interviews. When you go for councelling, make sure you get a written... read more

The best training institute is the one who will, on completion of the course, have given you a skill to be fluent with programming in python at the corporate level so that it will be easy to get great job offers and successfully crack job interviews. When you go for councelling, make sure you get a written guarantee for the above. Make sure there are lots of exercises, hands on assignments, interview questions and solutions provided.

read less
Answers 1 Comments
Dislike Bookmark

Answered 2 days ago IT Courses/Programming Languages/Python

Are there any reason to choose Ruby over Python?

Michael Devine

Many reasons. It depends on the clients requirement, the hardware and software available for design, development, testing and implementation, the skill set available for the project, the associations with other applications and platforms in the implementation environment, etc.
Answers 1 Comments
Dislike Bookmark

Answered 1 day ago IT Courses/Programming Languages/PHP

What is the average salary of a full stack developer with PHP as a back-end?

LEELAWATI

Trainer

Minimum salary of full stack developer with experience 1 years is 15-20k . It depends on your experience and logical skills that how far you go and how perfectly and qucikly you do your job . Php fullstack gets even 50 k in 3 -4 years experience. But every where the thing to to keep updated you... read more

Minimum salary of full stack developer with experience 1 years is 15-20k . It depends on your experience and logical skills that how far you go and how perfectly and qucikly you do your job . 

Php  fullstack   gets even 50 k in 3 -4 years  experience.

But every where the thing to to keep updated you skills.

read less
Answers 1 Comments
Dislike Bookmark

Looking for Programming Languages Classes

Find best Programming Languages Classes in your locality on UrbanPro.

FIND NOW

Answered 1 day ago IT Courses/Programming Languages/PHP

What is the best PHP development company in India?

LEELAWATI

Trainer

Dear Soumya There are many php development company in India.And which is best cant be considered exactly . It depends on projects they get and how much perfectly the developer handles. now a days many IT companies are taking php project even Infosys , Accenture . and there are may IT company ... read more

Dear Soumya 

There are many php development company in India.And which is best cant be considered exactly . It depends on projects they get and how much perfectly the developer handles.

now a days many IT companies are taking php  project  even Infosys , Accenture  .

and there are may IT company  which are solely for web development (Delta , Netsolutions , Grazitti Interactive... many more...)

read less
Answers 1 Comments
Dislike Bookmark

About UrbanPro

UrbanPro.com helps you to connect with the best Programming Languages Classes in India. Post Your Requirement today and get connected.

Overview

Questions 3.6 k

Lessons 213

Total Shares  

+ Follow 27,570 Followers

Related Topics

Top Contributors

Connect with Expert Tutors & Institutes for Programming Languages

x

Ask a Question

Please enter your Question

Please select a Tag

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 25 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 6.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more