SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 290 | Next

Shon Harris, Allen Harper, Chris Eagle, and Jonathan Ness

"Gray Hat Hacking, Second Edition"

You can grab that from the
MacPython download page linked from python.org if you need it later. Or you
can choose to edit and launch your Python from Xcode, Apple??™s development
environment, by following the instructions at http://pythonmac.org/wiki/XcodeIntegration.
Because Python is interpreted (not compiled), you can get immediate feedback from
Python using its interactive prompt. We??™ll be using it for the next few pages, so you
should start the interactive prompt now by typing python.
Hello World in Python
Every language introduction must start with the obligatory ???Hello, world??? example and
here is Python??™s:
% python
... (three lines of text deleted here and in subsequent examples) ...
>>> print 'Hello world'
Hello world
Or if you prefer your examples in file form:
% cat > hello.py
print 'Hello, world'
^D
% python hello.py
Hello, world
Pretty straightforward, eh? With that out of the way, let??™s roll into the language.
Python Objects
The main things you need to understand really well are the different types of objects that
Python can use to hold data and how it manipulates that data. We??™ll cover the big five
data types: strings, numbers, lists, dictionaries (similar to lists), and files.


Pages:
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302