1Programming Basicsand StringsThis chapter is a gentle introduction to the practice of programming in Python. Python is a veryrich language with many
In the second string, the Q. is stranded in the middle, with John and Public far to either side. Thebehavior on its right-hand side has just been expl
codeEditor can run a Python shell, where you can experiment with simple Python programming lan-guage statements.Within the shell, you have learned the
04_596543 ch01.qxd 6/29/05 10:59 PM Page 12
Note that programming in a language like Python, an interpreted language, means that you are notgoing to need to know a whole lot about computer hardw
being asked to exceed their capabilities, and they can fail gracefully by notifying their users that they’vestopped. In the best cases, you can create
or where something happened, based on the line number in the file. This is one of the features of a goodprogramming editor, and it makes it much easie
After you’ve started the shell, you’ll be presented with some information that you don’t have to be con-cerned about now (from, import, pcapp, and so
Why the Quotes?Now, back to strings in particular. Strings are the basic unit of text in Python. Unlike some other pro-gramming languages, a single le
significance from other special characters, such as quotes. This character in Python is the backslash ( \).Therefore, if you have to quote some text w
As you can see here, Python enables you to do what you want in triple-quoted strings. However, it doesraise one more question: What’s that \n doing th
Putting Strings Together in Different WaysAnother way to specify strings is to use a format specifier. It works by putting in a special sequence ofcha
Comments to this Manuals