PowerShell Guide to Python
PowerShell Guide to Python
A Comparative Approach to Learn two Scripting Languages at once. Fast!
About the Book
This PowerShell Scripting guide to Python is designed to make readers familiar with syntax, semantics and core concepts of Python language, in an approach that readers can totally relate with the concepts of PowerShell already in their arsenal, to learn Python fast and effectively, such that it sticks with readers for longer time.
"Use what you know to learn what you don't. " also known as Associative learning.
Book follows a comparative method to jump start readers journey in Python, but who is the target audience? and who should read this book -
- Any System Administrator who want to step into Development or Programming roles, and even if you don't want to be a developer, knowledge of another scripting language will make your skill set more robust.
- Python Developers who want to learn PowerShell scripting and understand its ease of user and importance to manage any platform.
- This book works both ways: As a reader you can use the book to learn Python if you know PowerShell, or learn PowerShell if you know Python. PowerShell and Python code samples and screenshots next to each other makes it very easy for readers to relate the common concepts and practices and learn the scripting language in no time.
Python is one of the top programming languages and in fast changing IT scenarios to DevOps and Cloud to the future - Data Science, Artificial Intelligence (AI) and Machine Learning Python is a must know.
But this PowerShell Scripting guide to Python would be very helpful for you if you already have some knowledge of PowerShell
NOTE! This is a Leanpub "Agile-published" book. That means the book is currently unfinished and in-progress. As I continue to complete the chapters, we will re-publish the book with the new and updated content. Readers will receive an email once a new version is published!
While the book is in progress, please review it and send any feedback or error corrections at email@example.com and you can also tweet me your queries here . Thank you.
Team Package of 5 Books
25% discount on each copy
Team Package of 10 Books
30% discount on each copy
Bundles that include this book
Good approach to grow-up your knowledge in Python very quickly
Learning Python becomes simple with this book when you come from the PowerShell world. Prateek has really done an awesome work of consolidating into one book what will take you several months to acquire this knowledge by yourself. What I like in this book is this approach to learn a new language from a language you know well. A really a good way to grow-up your knowledge in Python very quickly without too many difficulties.
Made for SysAmins who want to learn Python
As a regular SysAdmin with some basic PowerShell knowledge who want's to switch to DevOps, this book is building on whatever I already know to help me learn Python.
PowerShell as a segue to Python
As a programmer, I wanted to learn python, but since I am already working on Powershell. So this book was suggested to me which can help me learning python through Powershell. I started reading the book and from the 1st day itself, I found it so interesting, short crisp and simple way to learn something new. I must say this book not only helps in learning python but also pushed me to learn more things in PowerShell as well. Great book, recommended!
Learn 2 scripting languages at 2X speed
As an Infrastructure developer, you need multiple skills and this one is definitely helpful. Must read this book to upgrade your skills at 2x. Dear Prateek, Keep updating and upgrading us!
Thanks a lot for writing this amazing book that explains the concepts of two popular scripting language. Before reading this book, I was not sure to learn Python but now, not only I am aware of Python programming, also this book helped me to strengthen my basic concepts of PowerShell. If you know a bit about PowerShell and want to learn Python also then this is the right fit for you.
Table of Contents
- 1 Introduction
2 About the Book
- 2.1 Why did I write this book
- 2.2 Who is the Target Audience
- 2.3 Prerequisites
- 2.4 Feedback
3 The Basics
- 3.1 Version
- 3.2 Case Sensitivity
- 3.3 Indentation
- 3.4 Comments
- 3.5 Variables
4 Console Input/Output
- 4.1 Printing to Console
- 4.2 Reading from Console
- 4.3 Reading from Console Securely
5 Creating your First Script
- 5.1 Saving Commands as a Script File
- 5.2 Running the Script File
6 Passing Command-Line Arguments
- 6.1 ‘sys.argv’ in Python
- 6.2 ‘$args’ Automatic Variable in PowerShell
- 6.3 ‘Params()’ in PowerShell
- 6.4 ‘argparse’ Module in Python
- 6.5 Parameter Help
7 Object Introspection
- 7.1 Class, Object, Property, and Method
- 7.2 ‘Get-Member’ cmdlet in PowerShell
- 7.3 ‘type()’ Method in Python
- 7.4 ‘dir()’ Method in Python
- 7.5 ‘inspect’ Module in Python
8 The Help System
- 8.1 Get-Help cmdlet in PowerShell
- 8.2 ‘help()’ Method in Python
- 8.3 Understanding How a Module Works
- 9.1 Modular Programming
- 9.2 Importing Modules
- 9.3 Installing Modules
- 9.4 Creating Modules
10 Data Types
- 10.1 Common Data types
- 10.2 Checking the Data Type
- 10.3 Data type casting
11 String Manipulations and Formatting
- 11.1 Common String Operations
- 11.2 String Formatting
- 11.3 Substring or String Slicing
- 11.4 Testing String Membership
- 11.5 Built-in methods
12 Date and Time
- 12.1 Get Date and Time
- 12.2 Convert String to datetime object
- 12.3 DateTime formatting
- 12.4 Time Span or Time Delta
13 File Handling
- 13.1 Reading from a File
- 13.2 File Modes
- 13.3 Create and write to a text File
- 13.4 Appending data to the File
14 Arrays, List, ArrayList and Tuples
- 14.1 Arrays
- 14.2 ArrayList (.Net)
- 14.3 Lists
- 14.4 Common PowerShell Array and Python Lists Operations
- 14.5 Tuples
- 14.6 Sets
15 Dictionary and Hashtable
- 15.1 Hash Table
- 15.2 Dictionary
16 Conditional Statements
- 16.1 If Statement
- 16.2 Else Statement
- 16.3 The elif and ifelse statement
- 16.4 Nested Conditional Statements
- 17.1 For Loop
- 17.2 ForEach and ForeEach-Object
- 17.3 While Loop
- 17.4 Loop Control Statements
- 17.5 Nested Loops
- 18.1 Types of Functions
- 18.2 Creating a Function
- 18.3 Calling a Function
- 18.4 Functions vs Methods
- 18.5 Parameters and Arguments
- 18.6 Mandatory and Default parameters
- 18.7 The Anonymous Functions
19 Handling XML and JSON Data
- 19.1 Difference between JSON and XML
- 19.2 Reading XML from a file
- 19.3 Accessing XML as Objects
- 19.4 Accessing XML with XPath
- 19.5 Using XML for Object Serialization
- 19.6 Parsing JSON
- 19.7 JSON Serialization and De-Serialization
20 Reading and Writing CSV Files
- 20.1 What is CSV
- 20.2 Reading CSV File
- 20.3 Writing CSV File
21 Error Handling
- 21.1 Types of Errors
- 21.2 Raising an Exception or Throwing an error
- 21.3 Handling Exceptions using Try..catch..finally
22 Built-In Functions
- 22.1 Basic Mathematical Operations
- 22.2 Selection and Arrangement
- 22.3 Union and Intersection
- 22.4 Dynamic Execution of Code
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them