Python Programming: CH - 3 Standard Library and Regular Expression
Python Programming: CH - 3 Standard Library and Regular Expression
Python Programming: CH - 3 Standard Library and Regular Expression
Hitakshi Patel,
Ch - 3 Standard Assistant
Library Professor
and Regular Expression
Computer Science and Engineering, PIET
CHAPTER-3
Standard Library and Regular Expression
Standard Library and Modules
Python standard library provides
built in modules to use directly
Image source :
http://www.chaoxinto
Math for Mathematical Task
Import math library using : ‘import math’
List out various methods and constants using : ‘dir(math)’
Overview of module
>>> import os
Output:
C:\Users\Hitakshi\Python\test
OS Module: Make and change directories
>>> import os
>>> curr_dir= os.getcwd()
>>> print curr_dir
>>> os.mkdir(os.path.join(curr_dir,’test1’))
>>> os.chdir(os.path.join(curr_dir,’test1’))
Output:
C:\Users\Hitakshi\Python\test
C:\Users\Hitakshi\test\test1
OS Module: List all file in directory
>>> import os
Machine learning
library for
statistics
Solving Linear Algebra
Plot your Data
Graphics with Turtle
Regular Expression
Regular Expression
Matches the
beginning of line
Matching and Extracting Data
Match & find the position of the word starting with a
particular character
Matching and Extracting Data
Extract numbers from line using findall() method
Matches the number
re.findall(<re pattern> , <source_string>) from given sequence
[0-9]+
‘\S+@\S
+’ At least one
non-whitespace
regular expression for mobile number verification character