SlideShare a Scribd company logo
1 of 26
Python
Presented By: Yogesh Ingale and Prachit Patil
Automate using
Introduction
• Why Python?
• How can we automate the stuffs using Python?
• How can Python will make our life easier
• Playing with APIs
• Automations we have done using Python
Are you ready? Let’s Automate Everything…
Why Python
• Python is object-oriented
Structure supports such concepts as polymorphism,
operation overloading, and multiple inheritance
• It's free (open source)
Downloading and installing Python is free and easy
Source code is easily accessible
Free doesn't mean unsupported! Online Python
community is huge
• It's portable
Python runs virtually every major platform used today
As long as you have a compatible Python interpreter
installed, Python programs will run in exactly the same
manner, irrespective of platform
Why Python
• It's powerful
Dynamic typing
Built-in types and tools
Library utilities
Third party utilities (e.g. Numeric, NumPy, SciPy)
Automatic memory management
• It's mixable
Python can be linked to components written in other languages
easily
Linking to fast, compiled code is useful to
computationally intensive problems
Python is good for code steering and for merging
multiple programs in otherwise conflicting languages
World of API
An application programming interface (API) is a set of
routines, protocols and tools for building software
applications
World of API
World of API
{
"standard_resolution":{
"width":640,
"height":800,
"url":"https://scontent.cdninstagram.com/vp/ed5bd45010c503bdcabc0
3d12750113d/5C454ACB/t51.2885-
15/sh0.08/e35/p640x640/26152117_2110891475811181_701921361
5324463104_n.jpg"
}},
{
"created_time":"1515830944",
"caption":{
"id":"17918535826006407",
"text":"The best view comes after the hardest climb
ud83cudfd4ufe0f",
"created_time":"1515830944"
}},
{
"user_has_liked":false,
"likes":{
"count":191},
"tags":[ ],
"filter":"Sierra",
"comments":{
"count":3}},
{
"location":{
"latitude":31.103333333333,
"longitude":77.172222222222,
"name":"Himachal Pradesh",
"id":252633351 },
}
World of API
Python application NodeJS application
Using APIs
Standard Libraries
OS module
Some os module functions:
os.getcwd() # get current working directory
os.chdir('/usr/cs265') # change current working directory
os.system('mkdir lab1') # perform a mkdir in the system shell
Shutil module
• Use for daily file/directory management tasks
#copies data.db to archive.db
shutil.copyfile('data.db', 'archive.db')
#move(source, destination)
shutil.move('/build/executables', 'installdir')
Standard Libraries
re Module
• The re module provides regular expression tools for
advanced string processing.
• r - Python’s raw string notation for regular expression
patterns
re.findall(r'bf[a-z]*', 'which foot or hand fell fastest')
['foot', 'fell', 'fastest']
Standard Libraries
• Math Module
• Random Module
• Sys Module
• Datetime
• Data Compression
Data Structures
Data structures are a way of organizing and storing data so
that they can be accessed and worked with efficiently
Data Structures
Primitive
Non-primitive
• Integer
• Float
• String
• Boolean
• List
• Tuple
• Dictionary
• Sets
Data Structures
List
[‘a’,’b’,’c’]
Sortable
Sequence of
object
Grows and
shrinks as
needed
Tuple
(‘a’,’b’,’c’)
Immutable
Useful for
fixed data
Sequence type
Dict
{‘a’:’b’,’c’:’d’}
Key/value
pair
Keys are
immutable
Unordered
Set
{‘a’,’b’,’c’}
Store non-
duplicate item
Unordered
Math Set ops
(union,interse
cts)
• List : append(), insert(index,’str’), remove(), sort()
• Dict : keys(), values(), items(), get(key,default value),
setdefault(key,value to set)
• pprint.pprint()
• Lower(), upper(), isuuper(), islower()
• startswith(), endswith()
• Join(), split()
• Strip(), lstrip(), rstrip()
Data Structures
Scheduling Tasks and
Launching Programs
• The Time Module:
Based on Unix Epoch timestamp (12 AM on January 1, 1970)
Application : Stopwatch
Scheduling Tasks and
Launching Programs
• The DateTime Module:
To display a date in a more convenient format, or do arithmetic
operations with dates.
Scheduling Tasks and
Launching Programs
• The Subprocess Module:
- Open external applications
- poll() : like asking if program is still running
- Passing command line arguments
- Running other python/shell script
Scheduling Tasks and
Launching Programs
Sending Email and Text
Messages
• Simple Mail Transfer Protocol (SMTP)
Sending Email and Text
Messages
• Sending Text Messages with Twilio
Working with Excel and
CSV
• The openpyxl module:
o allows your Python programs to read and modify Excel spreadsheet
files
Working with Excel and
CSV
• The openpyxl module:
o Create and Save Excel Documents.
o Create and Remove Sheets.
o Set Font style and size.
o Apply Formulae:
Working with Excel and
CSV
• The openpyxl module:
o Adjust Row heights and Columns widths.
o Freeze Panes.
o Create Charts.
Working with Excel and
CSV
• The CSV module:
o CSV files are simplified spreadsheets stored as plaintext files. The advantage of
CSV files is simplicity.
o Read from CSV.
Working with Excel and
CSV
• The CSV module:
o Write to CSV.

More Related Content

What's hot

Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming Language
Laxman Puri
 

What's hot (20)

Python Crash Course
Python Crash CoursePython Crash Course
Python Crash Course
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Python Basics.pdf
Python Basics.pdfPython Basics.pdf
Python Basics.pdf
 
Introduction of python
Introduction of pythonIntroduction of python
Introduction of python
 
Fundamentals of Python Programming
Fundamentals of Python ProgrammingFundamentals of Python Programming
Fundamentals of Python Programming
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming Language
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
PYTHON FEATURES.pptx
PYTHON FEATURES.pptxPYTHON FEATURES.pptx
PYTHON FEATURES.pptx
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation Testing
 
Basics of python
Basics of pythonBasics of python
Basics of python
 
Python, the Language of Science and Engineering for Engineers
Python, the Language of Science and Engineering for EngineersPython, the Language of Science and Engineering for Engineers
Python, the Language of Science and Engineering for Engineers
 
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...
 
RESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and JenkinsRESTful API Testing using Postman, Newman, and Jenkins
RESTful API Testing using Postman, Newman, and Jenkins
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming
 
POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE
 
An Introduction To Automated API Testing
An Introduction To Automated API TestingAn Introduction To Automated API Testing
An Introduction To Automated API Testing
 
Python Intro
Python IntroPython Intro
Python Intro
 
Python made easy
Python made easy Python made easy
Python made easy
 
Python programming
Python  programmingPython  programming
Python programming
 

Similar to Automate using Python

Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptxQ-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
kalai75
 

Similar to Automate using Python (20)

Introduction_to_Python.pptx
Introduction_to_Python.pptxIntroduction_to_Python.pptx
Introduction_to_Python.pptx
 
CPP18 - String Parsing
CPP18 - String ParsingCPP18 - String Parsing
CPP18 - String Parsing
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
 
presentation on data science with python
presentation on data science with pythonpresentation on data science with python
presentation on data science with python
 
Apache Arrow Workshop at VLDB 2019 / BOSS Session
Apache Arrow Workshop at VLDB 2019 / BOSS SessionApache Arrow Workshop at VLDB 2019 / BOSS Session
Apache Arrow Workshop at VLDB 2019 / BOSS Session
 
PyDataStructs Tech Share at Quansight
PyDataStructs Tech Share at QuansightPyDataStructs Tech Share at Quansight
PyDataStructs Tech Share at Quansight
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
What is Python?
What is Python?What is Python?
What is Python?
 
Python ml
Python mlPython ml
Python ml
 
Introduction to Python Objects and Strings
Introduction to Python Objects and StringsIntroduction to Python Objects and Strings
Introduction to Python Objects and Strings
 
Python programming
Python programmingPython programming
Python programming
 
Kaggle tokyo 2018
Kaggle tokyo 2018Kaggle tokyo 2018
Kaggle tokyo 2018
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptxQ-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
Q-Step_WS_06112019_Data_Analysis_and_visualisation_with_Python.pptx
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Python indroduction
Python indroductionPython indroduction
Python indroduction
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Abhishek Training PPT.pptx
Abhishek Training PPT.pptxAbhishek Training PPT.pptx
Abhishek Training PPT.pptx
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

Automate using Python

  • 1. Python Presented By: Yogesh Ingale and Prachit Patil Automate using
  • 2. Introduction • Why Python? • How can we automate the stuffs using Python? • How can Python will make our life easier • Playing with APIs • Automations we have done using Python Are you ready? Let’s Automate Everything…
  • 3. Why Python • Python is object-oriented Structure supports such concepts as polymorphism, operation overloading, and multiple inheritance • It's free (open source) Downloading and installing Python is free and easy Source code is easily accessible Free doesn't mean unsupported! Online Python community is huge • It's portable Python runs virtually every major platform used today As long as you have a compatible Python interpreter installed, Python programs will run in exactly the same manner, irrespective of platform
  • 4. Why Python • It's powerful Dynamic typing Built-in types and tools Library utilities Third party utilities (e.g. Numeric, NumPy, SciPy) Automatic memory management • It's mixable Python can be linked to components written in other languages easily Linking to fast, compiled code is useful to computationally intensive problems Python is good for code steering and for merging multiple programs in otherwise conflicting languages
  • 5. World of API An application programming interface (API) is a set of routines, protocols and tools for building software applications
  • 7. World of API { "standard_resolution":{ "width":640, "height":800, "url":"https://scontent.cdninstagram.com/vp/ed5bd45010c503bdcabc0 3d12750113d/5C454ACB/t51.2885- 15/sh0.08/e35/p640x640/26152117_2110891475811181_701921361 5324463104_n.jpg" }}, { "created_time":"1515830944", "caption":{ "id":"17918535826006407", "text":"The best view comes after the hardest climb ud83cudfd4ufe0f", "created_time":"1515830944" }}, { "user_has_liked":false, "likes":{ "count":191}, "tags":[ ], "filter":"Sierra", "comments":{ "count":3}}, { "location":{ "latitude":31.103333333333, "longitude":77.172222222222, "name":"Himachal Pradesh", "id":252633351 }, }
  • 8. World of API Python application NodeJS application Using APIs
  • 9. Standard Libraries OS module Some os module functions: os.getcwd() # get current working directory os.chdir('/usr/cs265') # change current working directory os.system('mkdir lab1') # perform a mkdir in the system shell Shutil module • Use for daily file/directory management tasks #copies data.db to archive.db shutil.copyfile('data.db', 'archive.db') #move(source, destination) shutil.move('/build/executables', 'installdir')
  • 10. Standard Libraries re Module • The re module provides regular expression tools for advanced string processing. • r - Python’s raw string notation for regular expression patterns re.findall(r'bf[a-z]*', 'which foot or hand fell fastest') ['foot', 'fell', 'fastest']
  • 11. Standard Libraries • Math Module • Random Module • Sys Module • Datetime • Data Compression
  • 12. Data Structures Data structures are a way of organizing and storing data so that they can be accessed and worked with efficiently
  • 13. Data Structures Primitive Non-primitive • Integer • Float • String • Boolean • List • Tuple • Dictionary • Sets
  • 14. Data Structures List [‘a’,’b’,’c’] Sortable Sequence of object Grows and shrinks as needed Tuple (‘a’,’b’,’c’) Immutable Useful for fixed data Sequence type Dict {‘a’:’b’,’c’:’d’} Key/value pair Keys are immutable Unordered Set {‘a’,’b’,’c’} Store non- duplicate item Unordered Math Set ops (union,interse cts)
  • 15. • List : append(), insert(index,’str’), remove(), sort() • Dict : keys(), values(), items(), get(key,default value), setdefault(key,value to set) • pprint.pprint() • Lower(), upper(), isuuper(), islower() • startswith(), endswith() • Join(), split() • Strip(), lstrip(), rstrip() Data Structures
  • 16. Scheduling Tasks and Launching Programs • The Time Module: Based on Unix Epoch timestamp (12 AM on January 1, 1970) Application : Stopwatch
  • 17. Scheduling Tasks and Launching Programs • The DateTime Module: To display a date in a more convenient format, or do arithmetic operations with dates.
  • 18. Scheduling Tasks and Launching Programs • The Subprocess Module: - Open external applications - poll() : like asking if program is still running - Passing command line arguments - Running other python/shell script
  • 20. Sending Email and Text Messages • Simple Mail Transfer Protocol (SMTP)
  • 21. Sending Email and Text Messages • Sending Text Messages with Twilio
  • 22. Working with Excel and CSV • The openpyxl module: o allows your Python programs to read and modify Excel spreadsheet files
  • 23. Working with Excel and CSV • The openpyxl module: o Create and Save Excel Documents. o Create and Remove Sheets. o Set Font style and size. o Apply Formulae:
  • 24. Working with Excel and CSV • The openpyxl module: o Adjust Row heights and Columns widths. o Freeze Panes. o Create Charts.
  • 25. Working with Excel and CSV • The CSV module: o CSV files are simplified spreadsheets stored as plaintext files. The advantage of CSV files is simplicity. o Read from CSV.
  • 26. Working with Excel and CSV • The CSV module: o Write to CSV.