Namran Hussin Linux,Random Python Tips : Regular Expression usage to exclude something

Python Tips : Regular Expression usage to exclude something

Let’s say we want to match every single rain variation ..

“Isolated rain over coastal area” is rain.
“Scattered rain over inland area” is rain.
“Rain” is rain
However..
but not “No rain” .. is Fair weather ..

#!/usr/bin/python
import re
z = 1
y = 2
x = 3

if (z == 1) & (x == 3) & (y == 2):
 print "match"
else:
 print "not match"

norain = 'No rain'
rain = 'Rain'
rainfall = 'isolated rain interne'

zrain  =re.compile ('(?

result would be something like follows :

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post