Xah's {Python, Perl, Ruby} Tutorial

πŸπŸ«πŸ’Ž
, , …,

This is a tutorial on Perl, Python, and few other dynamic languages. The tutorial is concrete, example based, covering a practical subset of the language, using universal language features. The goal is to get you quickly started. You can start coding toy programs after a few hours. Then, you'll be able to understand οΌ† use official language reference for detail οΌ† advanced features.

New languages and snippets are added continuously. For latest news and additions, subscribe at Xah Programing Blog.

buy this tutorial for $15. Use the paypal button below. In the comment field, put β€œpython tutorial”. I'll email you the download link. Make sure your email address is included and correct.

there is a Python, pithy.
mighty, lissome, and tabby.
algorithms it puffs,
conundrums it snuffs.
and cherished by those savvy.
there is a camel, kooky.
ugly, loathsome, ungainly.
hacking it supports,
TIMTOWTDI it sports.
and transports DWIM-wit's fancy.
there is a gem called Ruby.
shiny and pretty.
objectively beautiful,
functionally magical.
make Rails of web happy.

Language in a Glance

Topic Python Perl Ruby PHP JavaScript Emacs Lisp
Language in a Glance Python Perl Ruby PHP JavaScript Emacs Lisp
Print Version Python Perl Ruby β—‡ β—‡ β—‡
doc lookup Python Perl Ruby β—‡ β—‡ β—‡

Note: for JavaScript and emacs lisp, they have dedicated pages. See: JavaScript Tutorial β—‡ Emacs Lisp Tutorial.

Language Basics by Topic

Topic Python Perl Ruby PHP JavaScript Emacs Lisp
Quoting String Python Perl Ruby β—‡ β—‡ β—‡
String Operations Python Perl Ruby β—‡ β—‡ β—‡
String Methods Python β—‡ β—‡ β—‡ β—‡ β—‡
Formatting String Python Perl Ruby β—‡ β—‡ β—‡
Regex Python Perl β—‡ β—‡ β—‡ β—‡
path manipulation Python β—‡ β—‡ β—‡ β—‡ β—‡
Unicode Python Perl Ruby β—‡ β—‡ β—‡
Topic Python Perl Ruby PHP JavaScript Emacs Lisp
True οΌ† False Python Perl Ruby β—‡ β—‡ β—‡
if then else Python Perl Ruby β—‡ β—‡ β—‡
for, while, loop Python Perl Ruby β—‡ β—‡ β—‡
Topic Python Perl Ruby PHP JavaScript Emacs Lisp
List Python Perl Ruby β—‡ β—‡ β—‡
Loop Thru List Python Perl Ruby β—‡ β—‡ β—‡
Map Ζ’ to List Python Perl Ruby β—‡ β—‡ β—‡
Sort Python Perl β—‡ β—‡ β—‡ β—‡
List Comprehension Python Perl β—‡ β—‡ β—‡ β—‡
List Methods Python β—‡ β—‡ β—‡ β—‡ β—‡
Hash Python Perl Ruby β—‡ β—‡ β—‡
Hash Methods Python β—‡ β—‡ β—‡ β—‡ β—‡
Topic Python Perl Ruby PHP JavaScript Emacs Lisp
Using Module Python Perl β—‡ β—‡ β—‡ β—‡
Function Python Perl Ruby β—‡ β—‡ β—‡
Writing Module Python Perl β—‡ β—‡ β—‡ β—‡

Common tasks.

Topic Python Perl Ruby PHP JavaScript Emacs Lisp
Reading οΌ† Writing File Python Perl β—‡ β—‡ β—‡ β—‡
Traverse Directory Python Perl β—‡ β—‡ β—‡ β—‡
Complex Numbers Python Perl Ruby β—‡ β—‡ β—‡
Environment Variable Python Perl β—‡ β—‡ β—‡ β—‡
JSON Python β—‡ β—‡ β—‡ β—‡ β—‡

Python Regex Reference

Python Regex Tutorial οΌ† Reference

Advanced, Specific, Tasks

Find/Replace

Unicode

Internet

HTML/Web

Unix Sys Admin

Topic Python Perl Ruby PHP JavaScript Emacs Lisp
System Call Python Perl β—‡ β—‡ β—‡ β—‡
gzip file Python Perl β—‡ β—‡ β—‡ β—‡

Functional Programing Exercises

Python Documentation Problems

Python Documentation Problems

Python Criticism

misc, unsorted

Topic Python Perl Ruby PHP JavaScript Emacs Lisp
Split Line by Regex Python Perl β—‡ β—‡ β—‡ β—‡

About The Author. Thanks to members of comp.lang.perl.misc and comp.lang.python for comments and corrections.

Python doc mirror:

blog comments powered by Disqus