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 prateek@ridicurious.com and you can also tweet me your queries here . Thank you.
Packages
The Book
PDF
EPUB
MOBI
WEB
English
Team Package of 5 Books
25% discount on each copy
PDF
EPUB
MOBI
WEB
English
Team Package of 10 Books
30% discount on each copy
PDF
EPUB
MOBI
WEB
English
Bundles that include this book
Reader Testimonials

Clisson Florian
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.
Miroslav Vasilev
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.

Manoj Sahoo
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!

Durgesh Patel
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!

Akshi Srivastava
Amazing book!
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 Modules
- 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 Loops
- 17.1 For Loop
- 17.2 ForEach and ForeEach-Object
- 17.3 While Loop
- 17.4 Loop Control Statements
- 17.5 Nested Loops
-
18 Functions
- 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
Do Well. Do Good.
Authors have earned$11,721,492writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
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), EPUB (for phones and tablets) and MOBI (for 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
Top Books
Recipes for Decoupling
Matthias NobackWrite software that survives
CQRS by Example
Carlos Buenosvinos, Christian Soronellas, and Keyvan Akbary- Leverage your Software Architecture skills by learning everything about CQRS in detail with lots of examples
- Develop faster applications by applying CQRS and fostering Read Models and Projections
- Learn how to apply CQRS into a brownfield project from a pragmatic approach
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
Maîtriser Apache JMeter
Philippe Mouawad, Bruno Demion (Milamber), and Antonio Gomes RodriguesToute la puissance d'Apache JMeter expliquée par ses commiteurs et utilisateurs experts. De l'intégration continue en passant par le Cloud, vous découvrirez comment intégrer JMeter à vos processus "Agile" et Devops.
If you're looking for the newer english version of this book, go to Master JMeter : From load testing to DevOps
C++20 - The Complete Guide
Nicolai M. JosuttisAll new language and library features of C++20 (for those who know previous C++ versions).
The book presents all new language and library features of C++20. Learn how this impacts day-to-day programming, to benefit in practice, to combine new features, and to avoid all new traps.
Buy early, pay less, free updates.
Other books:
Jetpack Compose internals
Jorge CastilloJetpack Compose is the future of Android UI. Master how it works internally and become a more efficient developer with it. You'll also find it valuable if you are not an Android dev. This book provides all the details to understand how the Compose compiler & runtime work, and how to create a client library using them.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Mastering STM32 - Second Edition
Carmine NovielloWith more than 1200 microcontrollers, STM32 is probably the most complete ARM Cortex-M platform on the market. This book aims to be the most complete guide around introducing the reader to this exciting MCU portfolio from ST Microelectronics and its official CubeHAL and STM32CubeIDE development environment.
Rector - The Power of Automated Refactoring
Matthias Noback and Tomas VotrubaLearn how to automatically and continuously upgrade and improve your PHP code base
The Hundred-Page Machine Learning Book
Andriy BurkovEverything you really need to know in Machine Learning in a hundred pages.
Top Bundles
- #2
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #3
Pattern-Oriented Memory Forensics and Malware Detection
2 Books
This training bundle for security engineers and researchers, malware and memory forensics analysts includes two accelerated training courses for Windows memory dump analysis using WinDbg. It is also useful for technical support and escalation engineers who analyze memory dumps from complex software environments and need to check for possible... - #4
Software Architecture
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #5
Static Analysis and Automated Refactoring
2 Books
As PHP developers we are living in the "Age of Static Analysis". We can use a tool like PHPStan to learn about potential bugs before we ship our code to production, and we can enforce our team's programming standards using custom PHPStan rules. Recipes for Decoupling by Matthias Noback teaches you in great detail how to do this, while also... - #9
All the Books of The Medical Futurist
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy, digital health investments and how technology giants such as Amazon...