ebook img

What you need to know about Python PDF

66 Pages·2016·1.645 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview What you need to know about Python

What You Need to Know about Python The absolute essentials you need to get Python up and running Pierluigi Riti BIRMINGHAM - MUMBAI What You Need to Know about Python Copyright © 2016 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First Published: August 2016 Production reference: 1120816 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. www.packtpub.com About the Author Pierluigi Riti is a cloud and DevOps engineer. He started development on a Commodore 64 when he was only 10 years old, and then continued to work with software and architecture. He moved on to DevOps and the cloud later. Pierluigi also specializes in continuous integration and continuous delivery, and is interested in all cloud technologies and architectures. You can contact him at [email protected]. I would like to thank my wife, Mara Ester, for giving me the best things in my life, our two kids, Nicole and Mattia. I would also like to thank the Packt Publishing team, especially Aishwarya and Larissa, without whose work this book would never have existed. About the Reviewer Sanjeev Jaiswal is a computer graduate with 5 years of industrial experience. He basically uses Perl and GNU/Linux for his day-to-day work. He also teaches Drupal and WordPress CMS to bloggers. He first developed an interest in web application penetration testing in 2013; he is currently working on projects involving penetration testing, source code review, and log analysis, where he provides analysis and defense against various kinds of web-based attacks. Sanjeev loves teaching technical concepts to engineering students and IT professionals, and has been teaching for the last 6 years in his leisure time. He founded Alien Coders (http://www.aliencoders.org), based on the learning through sharing principle, for computer science students and IT professionals in 2010, which became a huge hit in India among engineering students. He usually uploads technical videos to YouTube under the Alien Coders tag. He has got a huge fan base at his site because of his simple but effective way of teaching and his philanthropic nature toward students. You can follow him on Facebook at http://www.facebook.com/aliencoders and on Twitter at @aliencoders. He wrote Instant PageSpeed Optimization for Packt Publishing, and looks forward to authoring or reviewing more books for Packt Publishing and other publishers. www.PacktPub.com Support files, eBooks, discount offers, and more At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books, eBooks, and videos. TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt’s online digital book library. Here, you can access, read and search across Packt’s entire library of books. Why subscribe? • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content • On demand and accessible via web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. Table of Contents Overview v Chapter 1: Python in 2016 1 Getting started with coding 2 Storing and manipulating data in Python 2 Lists 3 Tuples 4 Dictionary 4 Sets 5 For loops 5 Functions 5 Using object-oriented programming in Python 6 Class methods 6 Chapter 2: Cloud and Web Development 8 Web applications with Django 8 Your first project with Django 9 The Django server 10 Our first Django app 11 Designing the app 12 Models in Django 12 Configuring the application 13 Migration 14 Creating the first UI 16 Django templates 17 Using the AWS SDK 18 REST web services with Flask 19 [ i ] Table of Contents Chapter 3: Data Visualization with Python 22 Installing Jupyter 22 Description of Jupyter Notebook 23 matplotlib 24 Creating our first notebook 25 Other kinds of cell 28 Chapter 4: Introduction to DevOps 30 The challenge of DevOps 30 Working with DevOps 31 What is Fabric? 31 Installing Fabric 32 The Fabric script 33 Using Fabric for DevOps 34 The Fabric API 34 The core API 34 Color output functions 34 Context managers 35 Decorators 35 Networks 36 Operations 36 Mixing it all together 37 SaltStack 39 Installing SaltStack 39 Configuring the client 40 Salt state 43 Chapter 5: Cheat Sheet 45 Python 45 Reserved words 45 Basic types 46 Ordered sequences 46 Immutable sequences 46 Key containers 46 Identifiers 46 Variables 47 List methods 47 String methods 47 Comments 48 [ ii ] Table of Contents Conditional statements 48 if 48 if…else 48 if…elif…else 48 Loop statements 49 for 49 while 49 Django 49 Starting a project 49 Creating a new application 49 Running the server 49 SaltStack 50 Key management 50 Checking connectivity 50 Showing all packages in the minion 50 Executing a command 50 Installing a package 50 Checking the network interface 51 Applying a state 51 Summary 51 [ iii ]

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.