Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Preface
How to Read This Book
Conventions Used in This Book
About Early Release books from O’Reilly
Using Code Examples
Safari® Books Online
How to Contact Us
1.
Why Read This Book? Why Learn These Skills?
Who Is This Book For?
Why Windows
Why Python
Base Python and Pandas
Anaconda Python
To install Anaconda Python (Windows or Mac)
Text Editors
Download Book Materials
Base Python and Pandas
Overview of Chapters
2. Python Basics
Running Python in the Shell
How To Create a Python Script
How to Run a Python Script
A few more hints for interacting with the command line
Up Arrow for Previous Command
Ctrl+c to Stop a Script
Read and Search for Solutions to Error Messages
Add More Code to first_script.py
Python’s Basic Building Blocks
Numbers
Integers
Floating-point numbers
Strings
Split
Join
Strip
Replace
Lower, Upper, Capitalize
Regular Expressions and Pattern Matching
Dates
Lists
Create a list
Index values
List slices
Copy a list
IN and NOT IN
Append, Remove, Pop
Reverse
Sorting
Tuples
Create a tuple
>Unpack tuples
Convert tuple to list, list to tuple
Dictionaries
Create a dictionary
Keys
Copy
IN, NOT IN, and GET
Sort
Control Flow
If-Else
If-Elif-Else
For Loops
Compact For Loops: List, Set, and Dictionary Comprehensions
List Comprehension
Set Comprehension
Dictionary Comprehension
While Loops
Functions
Exceptions
Try-Except
Try-Except-Else-Finally
Reading a Text File
Create a text file
Script and Input File in Same Location
Modern File Reading Syntax
Reading Multiple Text Files with Glob
Create another text file
Writing to a Text File
Writing to a Comma Separated Values “CSV” File
Print Statements
Chapter Exercises:
← Prev
Back
Next →
← Prev
Back
Next →