Книга: Fedora™ Unleashed, 2008 edition
Getting Interactive
Getting Interactive
We will be using the interactive interpreter for this chapter, so it is essential that you are comfortable using it. To get started, open a terminal and run the command python
. You should see this:
[paul@caitlin ~]$ python
Python 2.3.4 (#1, Oct 26 2004, 16:42:40)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
The >>>
is where you type your input, and you can set and get a variable like this:
>>> python = 'great' >>> python
'great'
>>>
On line 1, the variable python
is set to the text great
, and on line 2 that value is read back from the variable when you type the name of the variable you want to read. Line 3 shows Python printing the variable; on line 4, you are back at the prompt to type more commands. Python remembers all the variables you use while in the interactive interpreter, which means you can set a variable to be the value of another variable.
When you are finished, press Ctrl+D to exit. At this point, all your variables and commands are forgotten by the interpreter, which is why complex Python programs are always saved in scripts!
- CHAPTER 3 Getting Started
- DirectX Tutorial 1: Getting Started
- Running yum Noninteractively
- 4.5.4 Getting a List of Buffers
- 9.5.1 Getting Started
- Getting Around Fedora
- Getting Started with yum
- Chapter 19. Getting Exim Up and Running
- Getting Acquainted with NIS
- Getting started with standards-based storage
- Getting started with Work Folders
- Getting started with Print Management