0% found this document useful (0 votes)
73 views17 pages

Python/Programing Bootcamp: Network Automation Bonus

This document outlines an agenda for a Python programming bootcamp covering topics such as installation, environment setup, basic operators, decision making, loops, functions, file input/output, exception handling, classes and objects, and regular expressions. The bootcamp will teach Python fundamentals and provide examples for working with variables, operators, conditional statements, loops, defining functions, reading and writing files, exception handling, and using regular expressions. Installation instructions are provided for Windows and Mac OS X along with recommendations for using Eclipse and PyDev as an integrated development environment.

Uploaded by

Udit Bhatia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views17 pages

Python/Programing Bootcamp: Network Automation Bonus

This document outlines an agenda for a Python programming bootcamp covering topics such as installation, environment setup, basic operators, decision making, loops, functions, file input/output, exception handling, classes and objects, and regular expressions. The bootcamp will teach Python fundamentals and provide examples for working with variables, operators, conditional statements, loops, defining functions, reading and writing files, exception handling, and using regular expressions. Installation instructions are provided for Windows and Mac OS X along with recommendations for using Eclipse and PyDev as an integrated development environment.

Uploaded by

Udit Bhatia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Python/Programing Bootcamp

Network Automation Bonus


Spandan Naik (GDC B'lore)
April 2016
Elephant in the room
PYTHON
Agenda

Installation / Environment Setup

Basic Operators, Decision Making & Loops

Function, Files I/O, Exception Handling

Classes & Objects

Regular Expressions
Installation / Environment
Setup
Python 2.7.11
https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi (windows)
https://www.python.org/ftp/python/2.7.11/python-2.7.11-macosx10.6.pkg (mac OS-X)

Eclipse
Release : Mars

PyDev
Python IDE for Eclipse
Basic Operators, Decision
Making & Loops
Variable Types
Numbers
int (signed integers)
long (long integers, they can also be represented in octal and hexadecimal)
float (floating point real values)
complex (complex numbers)

String
List (Lists similar to arrays in c, but can have different data type)

Tuple (Similar to List but cannot be updated or changed)


Dictionary (Hash table type, consists of key-value pairs)
Basic Operators
Arithmetic Operator ( +, -, *, /, %, **, // )
Comparison Operator ( ==, !=, >, <, >=, <= )
Assignment Operator ( = , +=, -=, *=, /=, %=, **=, //= )
Logical Operator ( and, or, not )
Membership Operator ( in, not in)
Operators Precedence
(http://www.tutorialspoint.com/python/operators_precedence_example.htm)
Decision Making
If statement
Else statement
Elif statement
Loops
While expression:
Statement(s)

For iterating_var in sequence:


Statement(s)

Nested Loops
Break
Continue
Pass
Function, Files I/O,
Exception Handling
Function

A function is a block of organized, reusable code that is


used to perform a single, related action.

def functionname( parameters ):


"function_docstring"
function_suite
return [expression]
Files I/O

User Input
Raw_input
Input

Opening and Closing files


Writing into a file
Reading from a file
Creating Directory
Removing Directory
Exception Handling

Try try:
You do your operations here;
Except except ExceptionI:
If there is ExceptionI, then execute this block.
Else except ExceptionII:
If there is ExceptionII, then execute this block.
Finally except:
If there is any exception, then execute this block
else:
If there is no exception then execute this block.
finally:
This would always be executed.
Regular Expressions

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy