100% found this document useful (2 votes)
11 views

Automate the Boring Stuff with Python Practical Programming for Total Beginners 2nd Edition Al Sweigart download

Ebook installation

Uploaded by

abayahrambau42
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
11 views

Automate the Boring Stuff with Python Practical Programming for Total Beginners 2nd Edition Al Sweigart download

Ebook installation

Uploaded by

abayahrambau42
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Automate the Boring Stuff with Python Practical

Programming for Total Beginners 2nd Edition Al


Sweigart pdf download

https://ebookmeta.com/product/automate-the-boring-stuff-with-
python-practical-programming-for-total-beginners-2nd-edition-al-
sweigart/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

Automate the Boring Stuff with Python Practical


Programming for Total Beginners 1st Edition Al Sweigart

https://ebookmeta.com/product/automate-the-boring-stuff-with-
python-practical-programming-for-total-beginners-1st-edition-al-
sweigart/

Automate the Boring Stuff with Python Practical


Programming for Total Beginners 1st Edition Al Sweigart

https://ebookmeta.com/product/automate-the-boring-stuff-with-
python-practical-programming-for-total-beginners-1st-edition-al-
sweigart-3/

Automate the Boring Stuff with Python Practical


Programming for Total Beginners 1st Edition Al Sweigart

https://ebookmeta.com/product/automate-the-boring-stuff-with-
python-practical-programming-for-total-beginners-1st-edition-al-
sweigart-2/

Cultural Revolution Manuscripts Unofficial


Entertainment Fiction from 1970s China 1st Edition Lena
Henningsen

https://ebookmeta.com/product/cultural-revolution-manuscripts-
unofficial-entertainment-fiction-from-1970s-china-1st-edition-
lena-henningsen/
A TO Z INDIA OCTOBER 2022 3rd Edition A To Z India

https://ebookmeta.com/product/a-to-z-india-october-2022-3rd-
edition-a-to-z-india/

Tracks Vanessa Acton

https://ebookmeta.com/product/tracks-vanessa-acton/

Managing Customer Experiences in an Omnichannel World:


Melody of Online and Offline Environments in the
Customer Journey 1st Edition Ta■k■n Dirsehan

https://ebookmeta.com/product/managing-customer-experiences-in-
an-omnichannel-world-melody-of-online-and-offline-environments-
in-the-customer-journey-1st-edition-taskin-dirsehan/

Hardening Your Macs: Keeping Apple Computers Safe at


the Hardware and Software Level 1st Edition Jesus Vigo

https://ebookmeta.com/product/hardening-your-macs-keeping-apple-
computers-safe-at-the-hardware-and-software-level-1st-edition-
jesus-vigo-2/

Starting Over (Blossom Ridge Book 1) 1st Edition Becca


Jameson

https://ebookmeta.com/product/starting-over-blossom-ridge-
book-1-1st-edition-becca-jameson/
5 Day German Language Challenge Learn German In 5 Days
1st Edition Self

https://ebookmeta.com/product/5-day-german-language-challenge-
learn-german-in-5-days-1st-edition-self/
AUTOMATE THE BORING STUFF WITH
PYTHON
2ND EDITION

Practical Programming for Total Beginners

by Al Sweigart

San Francisco
AUTOMATE THE BORING STUFF WITH PYTHON, 2ND EDITION.
Copyright © 2020 by Al Sweigart.

All rights reserved. No part of this work may be reproduced or transmitted in any
form or by any means, electronic or mechanical, including photocopying, recording, or
by any information storage or retrieval system, without the prior written permission of
the copyright owner and the publisher.

Fifth printing

25 24 23 22 21 5 6 7 8 9

ISBN-10: 1-59327-992-2
ISBN-13: 978-1-59327-992-9

Publisher: William Pollock


Production Editor: Laurel Chun
Cover Illustration: Josh Ellingson
Interior Design: Octopod Studios
Developmental Editors: Frances Saux and Jan Cash
Technical Reviewers: Ari Lacenski and Philip James
Copyeditors: Kim Wimpsett, Britt Bogan, and Paula L. Fleming
Compositors: Susan Glinert Stevens and Danielle Foster
Proofreaders: Lisa Devoto Farrell and Emelie Burnette
Indexer: BIM Indexing and Proofreading Services

For information on distribution, translations, or bulk sales,


please contact No Starch Press, Inc. directly:

No Starch Press, Inc.


245 8th Street, San Francisco, CA 94103
phone: 1.415.863.9900; info@nostarch.com
www.nostarch.com

The Library of Congress Control Number for the first edition is: 2014953114

No Starch Press and the No Starch Press logo are registered trademarks of No Starch
Press, Inc. Other product and company names mentioned herein may be the
trademarks of their respective owners. Rather than use a trademark symbol with every
occurrence of a trademarked name, we are using the names only in an editorial fashion
and to the benefit of the trademark owner, with no intention of infringement of the
trademark.

The information in this book is distributed on an “As Is” basis, without warranty.
While every precaution has been taken in the preparation of this work, neither the
author nor No Starch Press, Inc. shall have any liability to any person or entity with
respect to any loss or damage caused or alleged to be caused directly or indirectly by
the information contained in it.

This work is licensed under the Creative Commons Attribution-NonCommercial-


ShareAlike 3.0 United States License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/us/ or send a letter to Creative
Commons, PO Box 1866, Mountain View, CA 94042, USA.
For my nephew Jack
About the Author
Al Sweigart is a software developer and tech book author. Python is his
favorite programming language, and he is the developer of several open
source modules for it. His other books are freely available under a
Creative Commons license on his website https://inventwithpython.com/.
His cat now weighs 11 pounds.
About the Tech Reviewer
Philip James has been working in Python for over a decade and is a
frequent speaker in the Python community. He speaks on topics ranging
from Unix fundamentals to open source social networks. Philip is a
Core Contributor to the BeeWare project and lives in the San Francisco
Bay Area with his partner Nic and her cat River.
BRIEF CONTENTS
Acknowledgments
Introduction

PART I: PYTHON PROGRAMMING BASICS


Chapter 1: Python Basics
Chapter 2: Flow Control
Chapter 3: Functions
Chapter 4: Lists
Chapter 5: Dictionaries and Structuring Data
Chapter 6: Manipulating Strings

PART II: AUTOMATING TASKS


Chapter 7: Pattern Matching with Regular Expressions
Chapter 8: Input Validation
Chapter 9: Reading and Writing Files
Chapter 10: Organizing Files
Chapter 11: Debugging
Chapter 12: Web Scraping
Chapter 13: Working with Excel Spreadsheets
Chapter 14: Working with Google Sheets
Chapter 15: Working with PDF and Word Documents
Chapter 16: Working with CSV Files and JSON Data
Chapter 17: Keeping Time, Scheduling Tasks, and Launching Programs
Chapter 18: Sending Email and Text Messages
Chapter 19: Manipulating Images
Chapter 20: Controlling the Keyboard and Mouse with GUI
Automation
Appendix A: Installing Third-Party Modules
Appendix B: Running Programs
Appendix C: Answers to the Practice Questions
Index
CONTENTS IN DETAIL
ACKNOWLEDGMENTS

INTRODUCTION
Whom Is This Book For?
Conventions
What Is Programming?
What Is Python?
Programmers Don’t Need to Know Much Math
You Are Not Too Old to Learn Programming
Programming Is a Creative Activity
About This Book
Downloading and Installing Python
Downloading and Installing Mu
Starting Mu
Starting IDLE
The Interactive Shell
Installing Third-Party Modules
How to Find Help
Asking Smart Programming Questions
Summary

PART I: PYTHON PROGRAMMING BASICS

1
PYTHON BASICS
Entering Expressions into the Interactive Shell
The Integer, Floating-Point, and String Data Types
String Concatenation and Replication
Storing Values in Variables
Assignment Statements
Variable Names
Your First Program
Dissecting Your Program
Comments
The print() Function
The input() Function
Printing the User’s Name
The len() Function
The str(), int(), and float() Functions
Summary
Practice Questions

2
FLOW CONTROL
Boolean Values
Comparison Operators
Boolean Operators
Binary Boolean Operators
The not Operator
Mixing Boolean and Comparison Operators
Elements of Flow Control
Conditions
Blocks of Code
Program Execution
Flow Control Statements
if Statements
else Statements
elif Statements
while Loop Statements
break Statements
continue Statements
for Loops and the range() Function
Importing Modules
from import Statements
Ending a Program Early with the sys.exit() Function
A Short Program: Guess the Number
A Short Program: Rock, Paper, Scissors
Summary
Practice Questions

3
FUNCTIONS
def Statements with Parameters
Define, Call, Pass, Argument, Parameter
Return Values and return Statements
The None Value
Keyword Arguments and the print() Function
The Call Stack
Local and Global Scope
Local Variables Cannot Be Used in the Global Scope
Local Scopes Cannot Use Variables in Other Local Scopes
Global Variables Can Be Read from a Local Scope
Local and Global Variables with the Same Name
The global Statement
Exception Handling
A Short Program: Zigzag
Summary
Practice Questions
Practice Projects
The Collatz Sequence
Input Validation
4
LISTS
The List Data Type
Getting Individual Values in a List with Indexes
Negative Indexes
Getting a List from Another List with Slices
Getting a List’s Length with the len() Function
Changing Values in a List with Indexes
List Concatenation and List Replication
Removing Values from Lists with del Statements
Working with Lists
Using for Loops with Lists
The in and not in Operators
The Multiple Assignment Trick
Using the enumerate() Function with Lists
Using the random.choice() and random.shuffle() Functions
with Lists
Augmented Assignment Operators
Methods
Finding a Value in a List with the index() Method
Adding Values to Lists with the append() and insert() Methods
Removing Values from Lists with the remove() Method
Sorting the Values in a List with the sort() Method
Reversing the Values in a List with the reverse() Method
Example Program: Magic 8 Ball with a List
Sequence Data Types
Mutable and Immutable Data Types
The Tuple Data Type
Converting Types with the list() and tuple() Functions
References
Identity and the id() Function
Passing References
The copy Module’s copy() and deepcopy() Functions
A Short Program: Conway’s Game of Life
Summary
Practice Questions
Practice Projects
Comma Code
Coin Flip Streaks
Character Picture Grid

5
DICTIONARIES AND STRUCTURING DATA
The Dictionary Data Type
Dictionaries vs. Lists
The keys(), values(), and items() Methods
Checking Whether a Key or Value Exists in a Dictionary
The get() Method
The setdefault() Method
Pretty Printing
Using Data Structures to Model Real-World Things
A Tic-Tac-Toe Board
Nested Dictionaries and Lists
Summary
Practice Questions
Practice Projects
Chess Dictionary Validator
Fantasy Game Inventory
List to Dictionary Function for Fantasy Game Inventory

6
MANIPULATING STRINGS
Working with Strings
String Literals
Indexing and Slicing Strings
The in and not in Operators with Strings
Putting Strings Inside Other Strings
Useful String Methods
The upper(), lower(), isupper(), and islower() Methods
The isX() Methods
The startswith() and endswith() Methods
The join() and split() Methods
Splitting Strings with the partition() Method
Justifying Text with the rjust(), ljust(), and center() Methods
Removing Whitespace with the strip(), rstrip(), and lstrip()
Methods
Numeric Values of Characters with the ord() and chr() Functions
Copying and Pasting Strings with the pyperclip Module
Project: Multi-Clipboard Automatic Messages
Step 1: Program Design and Data Structures
Step 2: Handle Command Line Arguments
Step 3: Copy the Right Phrase
Project: Adding Bullets to Wiki Markup
Step 1: Copy and Paste from the Clipboard
Step 2: Separate the Lines of Text and Add the Star
Step 3: Join the Modified Lines
A Short Progam: Pig Latin
Summary
Practice Questions
Practice Projects
Table Printer
Zombie Dice Bots

PART II: AUTOMATING TASKS


Another Random Scribd Document
with Unrelated Content
McGlory was gruff to the point of incivility. It was evident to Matt
that he had been mightily stirred.
"What's the matter with you?" demanded Matt.
"Wait till we get into the calliope tent, and out of this crowd and the
dust—then I'll tell you."
"Didn't you discover the trick Boss Burton played on me with the
help of Haidee and Le Bon, Joe?"
"Oh, speak to me about that!" snarled the cowboy. "Nary, I didn't,
pard, until it was too everlastin'ly late to stop the run of the cards.
Burton! We've got a bone to pick with him; and, after it's picked, I
feel like cramming it down his throat. He was bound to have the girl
go up, and he worked it in his sneaking, underhand way! I don't like
this layout, Matt. You've had the closest call that's ever come your
way since you took to flying. Sufferin' cats! Say, my heart was in my
throat all the while I was looking on. I was expecting that any
minute the fire would reach the gasoline, that both tanks would let
go, and that you, and the girl, and the Comet would all be wiped out
in a big noise and a splotch of flame."
By this time they had reached the calliope tent, and were able to
duck inside and get away from the crowd.
The calliope was there, and filling the larger part of the interior. The
big steam organ was shrouded in a canvas cover, and only the lower
rims of the wagon wheels on which it was mounted were to be seen.
Matt dropped down on a heap of straw and leaned back wearily
against a side pole. McGlory threw himself down beside him, his face
thoughtful and angry.
"I hadn't any notion Burton was running in a rhinecaboo," said the
cowboy presently, "until the Comet had jumped into the air and I
had looked back and seen Le Bon near the place from which the
machine had started. When I turned and looked at you and the
Comet, there was the Haidee girl perched on the lower wing,
throwin' kisses to the crowd. I knew then that Burton had turned his
trick, and I lammed loose a yell; but there was too much noise for
you to hear it. I kept my eyes on the aëroplane and the girl and—
and I saw something then that made my hair curl later when the fire
broke out."
"What was it?" asked Matt.
"Haidee, pushing something out on the left-hand wing and jabbing it
down there with a hatpin, so it would stay."
"We must have been three or four hundred feet away from you,
Joe," returned Matt, "and how could you see it was a hatpin?"
McGlory sat up, opened the front of his coat, and drew a blistered
hatpin out of the lining.
"I hunted around under the machine, while we were fighting the
fire," he explained, "and picked up that. So, you see, I know it was a
hatpin."
A frown crossed Matt's face.
"What do you make out of that move of Haidee's?" he asked.
"She pinned a ball of something soaked in oil to the wing and
touched it off," averred McGlory. "It smouldered for a while and then
blazed up and set fire to the canvas."
"Joe," returned Matt incredulously, "you must be mistaken. I've
always been a friend of Haidee's. Why should she want to destroy
the Comet, or me? When you come to that, why should she want to
take her own life? That's virtually what it would have amounted to if
the fire had reached the gasoline tanks."
"Who could have started the fire, if it wasn't the girl?" demanded
McGlory. "She was the one."
Matt was nonplused. His cowboy chum seemed to have drawn a
correct inference, but the supposition was so preposterous the king
of the motor boys could take no stock in it.
"We've got to use a little common sense, Joe," insisted Matt. "The
girl wouldn't have the least motive in the world for trying to do such
a thing as set fire to the Comet!"
"We've got to bank on what we see," answered McGlory, "no matter
whether we want to believe our eyes or not. Look at it! Haidee
comes to the aëroplane for the parade like a wooden figure of a girl,
moving like a puppet worked by strings. Suddenly she flashes out of
her locoed condition and pulls a lever that slams the Comet against
Rajah's heels. Well, we protected the girl from that because we
believed she was having one of her 'spells.' She came out of the
spell all of a sudden and lopes down to where the aëroplane stands
ready for the start. She seems as well as ever, and begs to go up on
the trapeze. A trick is played on us, and she does go up. Then, once
more, she gets the Comet into trouble. I can't savvy the blooming
layout, but I'm keen to know that some one is starting in to do us
up. And Haidee is one of our enemies."
Just then Boss Burton pushed into the tent. He was nervous and
cast furtive glances at Motor Matt.
"Great business!" he exclaimed. "Le Bon got juggled out of the
ascension, after all, and Haidee, the sly minx! did her stunt on the
trapeze, just as she had planned. How in the world did the machine
take fire? Crossed wires, or something?"
"You need not try to dodge responsibility, Burton," said Matt sharply.
"You put up the trick that was played on me."
"On my honor, King——"
"Don't talk that way," interrupted Matt. "Come out flat-footed and
admit it."
"Well," grinned Burton, a little sheepishly, "if you put it that way, I'll
have to acknowledge the corn. But the girl was clear-headed, wasn't
she? She didn't fall off the trapeze, and she pulled off some hair-
raising tricks on that flying bar that set the crowd gasping. It was
the biggest novelty in the way of an act that any show ever put up.
Results will show at the ticket wagon this afternoon. Too
confoundedly bad, though, that the thing should have been marred
by that fire. How long will it take you to fix up the machine? Can you
do it in time for an ascent to-night? I've planned to have Haidee
shoot off skyrockets from the trapeze, and Roman candles, and all
that."
"You'll have to cut out the fireworks, Burton," said Matt dryly. "It will
take a full day to repair the Comet."
Burton "went up in the air" on the instant.
"Think of the loss!" he exclaimed. "You've got to repair the machine
in time for the ascent this evening. If it's a matter of men, King, I'll
give you a dozen to help."
"It's not a matter of men," said Matt. "Joe and I are the only ones
who can work on the Comet. And listen to this—I mean it, and if you
don't like it we'll break our contract right here—Haidee has gone up
with me for the last time. I'll take Archie le Bon, or any one else you
want to send, but not Haidee."
"Is this what you call treating me square?" fumed Burton.
"Sufferin' Ananias!" grunted McGlory. "You're a nice lame duck to
talk about being treated square! You've got a treacherous outfit,
Burton, and Pard Matt and I are not beginning to like it any too
well."
Matt, thinking McGlory might tell what Haidee had done, gave him a
restraining look.
"You're responsible for the trouble that overtook the Comet, Burton,"
proceeded Matt.
"Me?" echoed the showman, aghast. "Well, I'd like to know how you
figure it."
"Through your schemes, and over my protest, Haidee made the
ascent with me."
"I'll admit that."
"If she hadn't made the ascent, there'd have been no fire."
"Do you mean to say——"
"Now, don't jump at any conclusions. I know what I'm talking about
when I tell you that there'd have been no fire if Haidee hadn't made
the ascent with me. That isn't saying, mark you, that the girl is to
blame for what happened. Would she want to burn the aëroplane
and drop herself and me plump into the show grounds? If——"
Just then a weird thing happened. The calliope gave a sharp clatter
of high notes.
All present in the tent gave astounded attention to the canvas-
covered music box.
"Spooks!" grinned Joe.
"There was enough steam left in the calliope to play a few notes,"
suggested Burton.
"But the notes couldn't play themselves," said Matt, and made a
rush for the calliope.
The keyboard was in one end of the calliope wagon, and the canvas
was draped over the chair occupied by the operator when the steam
wagon was in use.
With a pull, Matt jerked aside the canvas that covered the rear of the
calliope, and there, crouching in a chair, was Ben Ali!
CHAPTER VIII.
A CALL FOR HELP.
"Well, sizzlin' thunderbolts!" gasped the amazed Burton.
At first, Ben Ali sat blinking at those before him, apparently too
dazed to move.
"He's an eavesdropper!" cried McGlory, "and this ain't the first time
we've caught him at it, either. Grab him, Matt! Wring that thin neck
of his!"
Ben Ali regained his wits, then, and very suddenly. With a panther-
like spring, he cleared the wagon on the side opposite that where
Motor Matt was standing, dodged McGlory, who tried to head him
off, shook a glittering knife in Boss Burton's face, and vanished
under the wall of the menagerie tent. It was all so neatly done that
the three in the calliope lean-to were left staring at each other in
helpless astonishment.
McGlory rushed furiously at the menagerie tent wall, lifted the
canvas, then dropped it and rushed back.
"Not for me!" he breathed. "Rajah is right there, teetering back and
forth from side to side, and winding his trunk around everything in
sight."
"Where was Ben Ali?" demanded Burton, a glitter rising in his eyes.
"Getting out under the cages on the other side of the tent," replied
McGlory. "I'll see if I can't head him off."
With that the cowboy shot out of the lean-to. Matt didn't think the
effort to catch Ben Ali worth while, and once more dropped down on
the pile of straw.
For a few moments Boss Burton walked back and forth in front of
him, hands behind his back, head bowed in thought, and a black
frown on his face. Abruptly he halted in front of Matt.
"The infernal Hindoo drew a knife on me!" he scowled.
Matt nodded. The fact had been too plain to call for comment.
"I'd pull the pin on Ben Ali in half a minute," continued Boss Burton,
"if it wasn't for Haidee."
"Where did you pick up Ben Ali and Haidee?" inquired Matt.
"In Wisconsin," was the answer, "just as the show was starting out
of its winter quarters. Rajah had run amuck, wounded a horse,
smashed a wagon, and come within an ace of killing his keeper. Ben
Ali applied for the job of looking after him, and I let him have it. He's
been the only one, so far, who could take care of Rajah."
"Where did the girl come in?"
"She came in with her uncle, of course. Ben Ali said his niece was
good on the flying bar, and he brought her to see me. When she
came she was in one of her spells, and looked and acted like a
puppet, with some one pulling the wires. I wasn't much impressed
with her, but gave her a try-out. She recovered from the spell and
acted just as she did to-day, when she went up with the Comet—
perfectly natural. She gave a good performance—mighty good—and
I made a deal with her uncle. That's the way I got tangled up with
the pair. Why?"
The showman transfixed Matt with a curious glance.
"Oh, nothing," said Matt carelessly. "The Hindoo and the girl have
always been something of a mystery to me, and I wanted to find out
what you knew about them. Where did they come from?"
"Give it up. I never look into the past of people who hire out to me.
If they're capable, and do their work, that's enough. From what
McGlory said, and from what I've seen, Ben Ali appears to have been
sneaking around here, listening to what you and your friends were
saying. If he hadn't inadvertently touched the keyboard of the
calliope we shouldn't have known he was under the cover. Have you
any notion what he means by that sort of work?"
"No."
"Well, it's deuced queer, and that's all I can say. Do you think he
ought to be bounced?"
"Yes, but I wouldn't do it."
"On Haidee's account?"
"Partly that; partly, too, because, if you keep him on the pay roll, we
may be able to learn something about him and the girl. I'm a bit
curious about them, Burton."
"It's a bad habit—this of getting too curious. It's dollars and cents
for me to have the two with the show. What's more," and his
remarks took a more personal turn, "it's money in my pocket to have
the Comet go up this afternoon with Haidee shooting Roman candles
from the trapeze. When are you going to get busy with the repairs?"
"After I eat something."
"Well, rush the work, Matt. Do the best you can."
"It won't be Haidee who rides the trapeze next time the Comet takes
to the air," said the king of the motor boys firmly.
"Well, Archie le Bon, then," returned Burton, with much
disappointment.
As he went out, McGlory came in, passing him in the entrance.
"Nothing doing," reported the cowboy. "Where the Hindoo went is a
conundrum. I couldn't find anybody about the grounds who had
even seen him since he walked Haidee away from the burning
aëroplane."
While McGlory, disgusted with his ill success and the turn events
were taking, there on the banks of the Wabash, slumped down on a
bucket and mopped his perspiring face, Motor Matt dropped into a
brown study.
"These Hindoos are crafty fellows, Joe," he remarked, after a while.
"They're clever at a great many things we Americans don't
understand anything about. I knew one of them once. He was the
servant of a man who happened to be the uncle of one of the finest
young fellows that ever stepped—brave Dick Ferral. This particular
Hindoo I was able to study at close range."
"What are you leading up to by this sort of talk?" asked McGlory,
cocking his head on one side and squinting his eyes.
He had this habit when anything puzzled him.
"I'm leading up to the element of mystery that hangs over the
events of to-day. India is a land of mystery. The people are a dreamy
set, and now and then one of them will go off into the woods, or the
desert, and spend several years as a devotee. When he comes back
to civilization again he's able to do wonderful things. I've heard that
these fakirs can throw a rope into the air and that it will hang there;
and that they can make a boy climb the rope, up, and up, until he
disappears. Then rope, boy, and all but the fakir will vanish."
"Fakes," grunted Joe. "Such things ain't in reason, pard. You know
what a fakir is in this country, and I reckon he's not much better in
India."
"Of course it's a fake," said Matt, "but it's a pretty smooth piece of
magic. The Hindoo devotees could give Hermann and all the other
magicians cards and spades and then beat them out."
"I'm blamed if I can see yet where all this talk of yours leads to."
"I'm only, what you might call, thinking out loud," laughed Matt.
"Haidee's actions puzzle me. Her uncle is a Hindoo, and he may be
an adept in magic. If he is, just how much has the girl's queer
actions to do with Ben Ali? It's something to think about. I'm glad
Burton isn't going to cut loose from the Hindoo and the girl. The
more I see of them, the more curious I'm becoming."
"Ben Ali, pard," grinned McGlory, "is a little bit curious about us, I
reckon, from the way he's pryin' around. How do you account for
that?"
Matt shook his head.
"I can't account for it, Joe, but perhaps we'll be able to do so later."
He got up. "How about something to eat?" he asked. "We'll have to
have dinner, then take something to the boys, and get busy patching
up the aëroplane."
"Did you ever know me to shy at a meal?" asked McGlory, promptly
getting up. "We'll hit the chuck layout, and then——"
It was nearly time for the doors to open, and inside and out the two
big "tops" there was a bustle of preparation. The "spielers" in the
ticket stands at the side-show were yelling, people were crowding
about the ticket wagon, where they were to buy pasteboards
admitting them to the "big show," and a band was playing in the
road beyond the grounds.
Above all these various sounds there came a call, wild and frantic. It
reached the ears of the two boys in the calliope tent with strange
distinctness, and cut McGlory short while he was talking.
"Helup! Helup, somepody, or I vas a goner!"
The cowboy gave a jump for the door, only a foot or two behind
Matt.
"Was that your Dutch pard?" cried McGlory.
"It was his voice, plain enough," answered Matt, looking around
sharply.
"What could have gone wrong with him?"
"I can't imagine—here, in broad daylight, with the grounds full of
people."
"It's trouble of the worst kind if we're to take the words as they
sounded."
Matt believed this fully. Carl Pretzel was not the lad to give a false
alarm, and he had clearly put his whole heart into the words Matt
and McGlory had heard.
"Where did the call come from?" went on McGlory, mystified.
"It seemed to come from everywhere, and from nowhere," replied
Matt. "Look into the menagerie tent, Joe."
While McGlory was lifting the canvas and taking a look through the
animal show, Matt rounded the outside of the lean-to, searching
every place with keen eyes.
Carl was nowhere to be found. As Matt drifted back toward the door
of the calliope tent, McGlory emerged and joined him.
"He's not mixed up with the animals," reported the cowboy.
"And I can't get any trace of him out here," said Matt. "Let's walk
over to the aëroplane. Carl and Ping were to watch the machine, and
I'm pretty sure neither of them would leave it without orders unless
something pretty serious had gone wrong."
Vaguely alarmed, the two chums pushed their way through the
crowd toward the place where the Comet had been left.
CHAPTER IX.
BLACK MAGIC.
While the parade was passing through town, Carl had been
"sleuthing." The fact that he was wearing McGlory's working clothes
gave him an idea. He didn't look like himself, so why not be some
one else? All the detective books he had ever read had a good deal
to say about disguises. Carl was already disguised, so he made up
his mind that he would be a dago laborer.
After watching the parade file out of the show grounds, he slouched
over to the side-show tent. A man was just finishing lacing the
picture of a wild man to the guy ropes. Carl shuffled up to him.
"I peen der Idaliano man," he remarked, in a wonderful combination
of Dutch and Italian dialect, "und I, peen make-a der look for a
leedl-a gal mit der name oof Manners. Haf-a you seen-a der girl
aroundt loose some-a-veres?"
The canvasman looked Carl over, and then, being of a grouchy
disposition, and thinking Carl was trying to make fun of him, he gave
him a push that landed him against a banner containing a painted
portrait of the elastic-skin man. The banner was even more elastic
than the image it bore on its surface, for Carl rebounded and struck
one of the "barkers," who happened to be passing with his hands
full of ice-cream cones for the bearded lady and the Zulu chief.
Disaster happened. The "barker" fell, with the Dutch "tedectif" on
top of him—and the ice-cream cones in between.
The "barker" indulged in violent language, and began using his
hands. Carl was pretty good at that himself, and retaliated. Two
canvasmen pulled the two apart. Carl had the contents of a cone in
his hair, and the "barker" had the contents of another down the back
of his neck.
"Where'd that ijut come from?" yelled the "barker," dancing up and
down among the broken cones.
"Who left der cage toor oben?" cried Carl, digging at his hair. "Der
papoon vas esgaped."
"You put up your lightning rod," growled the "barker," "or you'll git
hit with a large wad of electricity."
"Come on mit it!" whooped Carl, fanning the air with his fists. "No
vone can make some ice-gream freezers oudt oof me mitoudt hafing
drouples!"
"That'll do you," snorted the canvasman who had hold of Carl, and
thereupon raced him for twenty feet and gave him a shove that
turned him head over heels across a guy rope.
"Dot's der vay," mourned Carl, picking himself up and gathering in
his hat. "Der tedectif pitzness comes by hardt knocks, und nodding
else. Vere can I do some more?"
His head felt cold and uncomfortable, even after he had mopped it
dry with a red cotton handkerchief.
He went over to the horse tent. The tent was nearly empty, all the
live stock except a trick mule being in the parade. The mule would
not have been there, but he was too tricky to trust in the procession.
A man with a red shirt, and his sleeves rolled up, sat on a bale of
hay close to the mule. The man was smoking.
"Hello, vonce," flagged Carl.
"Hello yourself," answered the man.
"I peen some Idaliano mans," remarked Carl, "und I vas make-a der
look for Markaret Manners, yes. Haf-a you seen-a der gal?"
"Take a sneak," said the man.
"She iss-a leedle-a gal aboudt so high, yes," and Carl put out his
hand. "I peen-a der poor Idaliano man, aber I gif-a you fife tollars,
py shiminy, oof-a you tell-a me where-a der gal iss."
"You can't josh me," went on the man earnestly. "Hike, before I
knock off your block."
Carl continued to stand his ground and ask questions; then, the next
thing he knew, the hostler had jumped up and rushed for him. Carl
sprang back to get out of the way, unfortunately pushing against the
hind heels of the mule. The mule knew what to do, in the
circumstances, and did it with vigor.
Carl was kicked against the man with the pipe, and that worthy
turned a back somersault as neatly as any "kinker" belonging to the
show.
The Dutch boy limped hastily around the end of the horse tent and
crawled into an empty canvas wagon. The mule's heels had struck
him with the force of a battering-ram, and he felt weak up and down
the small of the back. Besides, the wagon was a good place in which
to hide from the hostler.
Cautiously he watched over the wagon's side. The hostler came
around the side of the tent, looked in all directions, and then retired,
muttering, in the direction of the bale of hay.
Carl chuckled as he dropped down on a roll of extra canvas, but the
chuckle died in a whimper as he became conscious of his sore spots.
"I vonder how Cherlock Holmes efer lifed to do vat he dit," he
murmured, curling up on the canvas. "Der tedectif pitzness iss hit
und miss from vone end to der odder, und den I don'd get some
revards. Meppy I vill shleep und forged id."
When Carl woke up, he looked over the side of the wagon and saw a
burning flying machine in the air, and he heard the wild yells of the
crowd. Probably it was the yelling that awoke him.
"Py shinks," he cried, "dot's my bard, Modor Matt! He iss purnin' oop
mit himseluf. Fire! Fire! Helup!" and Carl rolled out of the wagon and
raced toward the spot where the machine seemed to be coming
down.
McGlory, white-faced but determined, was marshaling a lot of men
with buckets of water. Carl dropped in. When the machine landed,
he set to with the rest and helped extinguish the flames.
Then, after he had congratulated Matt, Carl and Ping were placed on
guard.
In spite of the fact that Carl had shaken hands with Ping, he
continued to have very little use for the Chinaman. And Ping, to
judge from appearances, had no more use for the Dutchman. They
did not speak. One sat down on one side of the machine and the
other sat down on the other. Then a brown man, wearing an
embroidered coat and a turban, drove up on a small cage wagon
drawn by one horse. He got off the wagon and stepped up to Carl.
"How-do, sahib?" said the man.
Carl remembered him. He was the fellow who had been dozing on
Rajah's back at the river. Also he was the man who had taken charge
of the girl who had dropped off the trapeze when the burning
aëroplane came down.
Carl had a startling thought—it flashed over him like an inspiration.
"How you vas?" answered the Dutch boy genially.
"You come 'long with Ben Ali," said the man.
"Nod on your dindype," replied Carl. "I vas vatching der machine for
Modor Matt."
"You come!" hissed Ben Ali.
Then Carl noted something very remarkable. The Hindoo's eyes
began to blaze, and dance, and show wonderful lights in their
depths.
"Shtop mit it!" said Carl. "You peen a mesmerizer, und I don'd like
dot."
Carl knew he couldn't be hypnotized against his will, but the
Hindoo's eyes were working havoc with his nerves.
"You come!"
The words of Ben Ali were imperative. Carl, seemingly unable to
remove his own eyes from the Hindoo's, followed as Ben Ali
retreated toward the wagon. At the end of the wagon Ben Ali made
some passes with his hands in front of Carl's face, then opened the
door.
"You get in, sahib!"
Carl climbed into the wagon mechanically. Slam went the door and
click went a key in the padlock.
The Comet had come down from its disastrous flight at a
considerable distance from the tents. There were no people in the
immediate vicinity save Ping.
The little Chinaman, on hands and knees under the lower wing of
the aëroplane, was watching covertly all that took place.
After locking the door of the cage wagon, Ben Ali took a cautious
look around him. He saw no one.
Climbing up on one of the forward wheels, he took a slouch hat and
a long linen duster from the seat, removed his embroidered coat and
his turban, got into the hat and duster, climbed to the seat, picked
up the reins, and drove off.
Ping had seen it all, but had made no attempt to interfere. And he
made no attempt now.
He did not like the "Dutchy boy." He was afraid Carl would take away
from him his job with Motor Matt.
It was with secret rejoicing, therefore, that the Chinaman saw Carl
locked in the wagon and hauled away.
"Hoop-a-la!" chattered Ping, as he returned to his place and once
more went on watch.
The wagon used by Ben Ali, on this momentous occasion, was
technically known as the monkey wagon. Two of the monkeys had
eaten something which did not agree with them, and had died in
Indianapolis. The three that remained had been taken out and put in
another cage, with a collection known as "The Happy Family." This,
of course, left the monkey wagon empty.
Burton was figuring on using it for one of the ant-eaters, but there
were some repairs to be made before the wagon could be put to
that use. The repairs dragged, and so Ben Ali found his opportunity
to use the cage.
Straight across the show grounds drove the disguised Hindoo. None
of the employees who saw him recognized him or questioned his
right to use the monkey wagon. Different gangs had different duties,
and no one knew but that this strange driver was off to town on
some important mission.
Ben Ali drove within a hundred feet of the calliope tent. When he
was well beyond it, a yell came from inside the wagon.
"Helup! Helup, somepody, or I vas a goner!"
A shiver ran through Ben Ali. He made ready to leap from the
wagon, but thought better of it when he saw that the call had
attracted no attention and was not repeated.
"Sahib keep still!" he called, kicking the end of the wagon with his
heels.
And thus, with not a sound coming from the interior of the monkey
wagon, the artful Hindoo adept drove into the road and headed the
horse away from the town and into the country.
CHAPTER X.
THE MAHOUT'S FLIGHT.
When Matt and McGlory, hurrying to the aëroplane to make inquiries
concerning Carl, came within sight of Ping, they saw him calmly
occupied twirling a set of jackstones.
"Ping!" called Matt.
"Awri'!" answered Ping, slipping the jackstones into a pocket of his
blouse and immediately getting up.
"Where's Carl?"
"Dutchy boy no good. Him lun away."
"Run away?" echoed McGlory. "Here's a slam! When and how, Ping?"
"Ben Ali dlive 'lound in wagon. Him say to Dutchy boy, 'You come.'
Dutchy boy makee come chop-chop. Ben Ali shuttee do', put on
Melican coat, Melican hat, makee dlive off. Woosh! Dutchy boy no
good."
This offhand description of what had happened to Carl was received
with startled wonder by Matt and McGlory.
"When was this?" demanded Matt.
"Plaps fi' minit, plaps ten minit. No gottee clock, Motol Matt; no
savvy time."
"You say Ben Ali drove up in a wagon?"
"Dlive up in monkey wagon. Put Dutchy boy in monkey wagon."
"And then he locked Carl inside?"
"Allee same."
"And took off his turban and embroidered coat and replaced them
with another hat and coat?"
"Melican hat, plenty long coat."
"Wouldn't that rattle your spurs, pard?" murmured McGlory.
"What did Ben Ali do?" went on Matt, resolved to get at the bottom
of the matter, if possible.
"Him makee funny look with eye," replied Ping. "By Klismus! him
blame' funny look. One piecee devil shine in eye."
"Hypnotized!" grunted McGlory.
"You can't easily hypnotize a person against his will," averred Matt.
"It's not hard to guess that Carl was a good way from being willing
to go with Ben Ali."
"What the dickens did Ben Ali want to run off Carl for?" queried
McGlory.
"This business gets more and more mysterious, Joe," returned Matt,
"the farther we go into it."
"And that yell we heard!"
"That certainly came from Carl. Ben Ali must have driven past the
calliope tent while we were talking inside. The fact that Carl gave a
yell for help proves that he wasn't wholly hypnotized."
"He may have come out from under the influence just long enough
to give a whoop," suggested the cowboy.
"Let's go back and hunt up Burton," said Matt. "He'll want his
monkey wagon, and, of course, we've got to get hold of Carl."
"It's news to discover that Ben Ali is a hypnotist," observed McGlory,
as he and Matt whirled and started to retrace the ground over which
they had just passed.
"I told you these Hindoos were a crafty set," answered Matt.
The doors were open and the crowd was vanishing inside the big
tents. The grounds were not so congested with people as they had
been, and it was easier to get about and hunt for Burton.
As it chanced, they ran plump into the manager just as they were
rounding the dressing tent at the end of the circus "top."
Burton was red and perspiring, and there was wrath in his face.
"I've been looking all around for you fellows," he cried. "You can run
one of these here buzz-wagons, can't you, Matt?"
"Yes," replied Matt, "but——"
"Come along," interrupted Burton, grabbing Matt by the arm, "we
haven't any time to spare."
"Wait!" protested Matt, drawing back. "Have you seen——"
"Can't wait," fumed Burton. "I've hired a chug-car; and there's a
race on. Haidee has skipped. Aurung Zeeb, one of the other Hindoo
mahouts, has helped her get away. They've taken my runabout.
Confound such blooming luck, anyhow!"
Here was news, and no mistake. Ben Ali running off with Carl, and
Aurung Zeeb taking to the open with the showman's Kentucky cob
and rubber-tired buggy!
"Do you know where Aurung Zeeb and Haidee went?" asked Matt.
"I haven't the least notion," was the wrathful answer, "but we've got
to find them. I don't care a straw about Zeeb, or the girl, but that
runabout rig is worth six hundred dollars, just as it stands."
"Well, if you don't know which way the rig went," argued Matt, "it's
foolish to go chasing them and depending on luck to point the way."
"We've got to do something!" declared Burton.
"Where's Ben Ali?"
"Oh, hang Ben Ali! I haven't seen him since he flashed that knife in
my face."
"We've just discovered," proceeded Matt, "that he has skipped out,
too, and taken your monkey wagon along."
"Sure of that?"
"Ping just told us. Not only that, Burton, but he took my Dutch pard
—the lad that came this morning—with him. Carl was locked in the
cage."
"Worse and worse," ground out Burton. "How'd Ben Ali ever manage
to do that?"
"On the face of it, I should say that Ben Ali had hypnotized Carl."
"Nonsense! What does an elephant driver know about hypnotism?
Still, this begins to look like a comprehensive plan to steal a monkey
wagon and a runabout and leave me in the lurch. What do you think
of that Haidee girl to do a thing like this? She seemed mighty
anxious to earn money, yet here she skips out with about a hundred
in cash to her credit."
"It's hard to understand the turn events have taken," said Matt. "But
I wouldn't blame Haidee too much until you know more about her—
and about Ben Ali."
"I want my horses and my rolling stock," fretted Burton. "The rest of
the outfit can go hang, if I get back the plunder."
"You said something about an automobile," said Matt.
"There's a car here, and the man that owns it is seeing the show. He
said I could have the use of the car all afternoon for fifty dollars. He
thought I was an easy mark, and I let him think so. He's got the
money and I've got the car. After he'd gone inside, I happened to
remember that I couldn't run the thing, so I chased off looking for
you. Here we are," and the three, who had been walking in the
direction of the road, came to the side of a large automobile.
It was a good machine, with all of six cylinders under the hood.
"If you're a mind reader, and can tell where we ought to go, Burton,"
said Motor Matt, "I'll get you there. I feel right at home when I'm in
the driver's seat of a motor car."
"Wait till I ask somebody," and Burton whirled and flew away.
"Gone to have some fortune teller read his palm," laughed McGlory.
"Oh, but he's wild when he gets started."
"I don't blame him for worrying," said Matt. "He was offered four
hundred, spot cash, for that Kentucky cob, in Indianapolis. Shouldn't
wonder if he stood to lose a thousand dollars if the runaways can't
be overhauled. And he hasn't much time to overhaul them, either,
Joe. The three sections of the show train have got to be on the
move toward South Bend by three in the morning. I'm worried some
myself, on Carl's account. What has that crafty mahout got at the
back of his head? I wish I knew. You and I are going to stay right
here in Lafayette until we can find out something about Carl."
"Sure we are," agreed the cowboy heartily. "But here comes Burton,
and he looks as though he'd found out something."
"One of the canvasmen," announced Burton breathlessly, as he came
up with the boys, "says that he saw the monkey wagon heading
south into the country. Can't find out which way the runabout
headed, but we'll take after the other outfit. Get in and drive the
machine for all you're worth."
Matt passed around in front, and was pleased with the business-like
manner in which the motor took up its cycle.
"Here's where we throw in the high-speed clutch and scoot," said
Matt, settling into the driver's seat with a glad feeling tingling along
his nerves. It had suddenly occurred to him that he would rather
motor in a high-powered car than do anything else that had so far
claimed his attention. In such a machine, "miles were his minions
and distance his slave." "Here we go," he finished, and away
bounded the car.
Matt took time to wonder at the nature of a plutocrat who, for fifty
dollars, would trust such a beautiful piece of mechanism in the
hands of a showman. But the fact was accomplished, and guesses at
the reason were futile.
They came to a hill—a steepish kind of a hill, too—and they went
over it without a change of gear. Motor Matt laughed exultantly.
"Took it on the high speed!" he cried. "A car that can do that is a
corker."
On the opposite side of the hill, as they were scorching down with
the speedometer needle playing around the fifty-eight mark, a team
and wagon containing a farmer and his family were almost backed
off the road. Matt tampered with the brakes, but the car was going
too fast to feel the bind of the brake grip.
"Never mind!" cried Burton, from his place at Matt's side. "That outfit
is going to the show to-night. If I see 'em, I'll pass 'em all in with
fifty-cent chairs. Now, boy, hit 'er up. I've got to recover my property
before night sets in, and this may be a long chase."
"Long chase!" yelped McGlory derisively from the tonneau. "How can
it be a long chase when we're going like this? Hang on to your hair,
Burton! Mile-a-minute Matt's at the steering wheel."
CHAPTER XI.
THE PAPER TRAIL.
The coils hummed merrily to the six-cylinder accompaniment. The
wind whistled and sang in the ears of the three who were plunging
along at a speed which was bound to get them somewhere in short
order.
Then, as might be expected, something happened. It was no
accident to the car. The road spread apart in two equally well-
traveled branches, and Matt shut off and came to a stop at the forks.
"The canvasman, of course," said the young motorist, looking
around at Burton, "couldn't tell you which fork the monkey wagon
would take."
"Here's a go!" muttered Burton. "If we take one fork, we may be
hustling off on the wrong scent. At a guess, I should say take the
right-hand branch."
"Let's not do any guessing until we have to," Matt returned. "My
cowboy chum here is a good hand at picking up trails. Show us how
they do it in Arizona, Joe."
McGlory was out of the car in a flash and giving his attention to the
surface of the road.
"You might as well try to hunt for the print of a rabbit's foot in the
trail of a herd of stampeded steers," said McGlory, after five precious
minutes spent in fruitless examination.
"What sort of a cowboy are you, anyhow?" scoffed Burton.
"Well, look," answered McGlory. "The ground is all cut up with
people coming to the show, and it's none too soft. I couldn't pick out
the tread of a traction thrashing machine in all this jumble of prints."

You might also like