This is my 13 day of #100daysofcode. Today I learned more about CSS properties like create a gradual CSS linear gradient, use a linear gradient to create a striped element, create texture by adding a subtle pattern as a background image, use the CSS transform scale property to change the size of an image, use the CSS transform scale property to scale an element on hover etc from freecodecamp.
Also I learned something about web access to python from Coursera.
Below is my code of this day
Spam Confidence
Regular expression referred to as "regex" or "regexp", provides a concise and flexible means for matching strips of text. My code is start with importing regular expression as re as given below.
import re
After that we open the file as hand and I build the list to put the number. I started the loop after that I strip line. We going to look findall . Look for the line start with X quit it will be stop in the blank. Then it will start extracting 0 through 9 for floating number bracket one or more time and the we end extracting. There is exactly one extraction. If there is no extraction then this code run empty extraction. This stuff is the list of the matches. If there will be more than one that type of floating number go through below and choose the maximum one.
hand = open("mbox-short.txt")
numlist = list()
for line in hand:
line = line.rstrip()
stuff = re.findall('^X-DSPAM-Confidence: ([0-9.]+)',line)
if len(stuff) != 1 : continue
num = float(stuff[0])
numlist.append(num)
print('Maximum:',max(numlist))
Day 13 of #100dysofcode and #Python
— Durga Pokharel (@mathdurga) January 6, 2021
* More about CSS properties including create a gradual css linear gradient , use a css linear gradient to create a striped element, create texture by adding a subtle pattern as a background image..
* More about python to access web data pic.twitter.com/Mg2vXHWnoa
Top comments (0)