LPTHW Exercise 13-14: Parameters, Unpacking, Variables, Prompting and Passing

Learn Python the Hard Way by Zed Shaw .: Add extra libraries or modules of code to a program using import and supply arguments to a Python script on the command line using argv.

The textwrap module enables indenting a block quote for cleaner code but moving to left-margin at print() time:

import sys
import textwrap

script, firstName, lastName = sys.argv

message = """
    (O< .: Learn Python The Hard Way
print('{} {} ' + ', author of' + '.' * 10).format(firstName, lastName)


$ python e13.2.py Zed Shaw

    (O< .: Learn Python The Hard Way

Zed Shaw , author of..........

(O< .: Learn Python The Hard Way


More • pythonprogramming