Dive Into Python-Chapter 3. Native Datatypes
... implied. So li[ :3] is the same as li[0 :3] from Example 3. 8, “Slicing a List”. Similarly, if the right slice index is the length of the list, you can leave it out. So li [3: ] is the same as li [3: 5], because ... list, li[ -3] == li[5 - 3] == li[2]. Example 3. 8. Slicing a List >>> li ['a', 'b', 'mpilgrim', 'z', 'example'] >&...
Ngày tải lên: 07/11/2013, 10:15
Dive Into Python 3 pptx
... ② ['c:\\Users\\pilgrim\\diveintopython3\\examples\\feed-broken.xml', 'c:\\Users\\pilgrim\\diveintopython3\\examples\\feed-ns0.xml', 'c:\\Users\\pilgrim\\diveintopython3\\examples\\feed.xml'] 1. ... NEW IN DIVE INTO PYTHON 3 ❝ Isn’t this where we came in? ❞ — Pink Floyd, The Wall -1.1. A.K.A. “THE MINUS LEVEL” Are you already a Python programmer? Did you read...
Ngày tải lên: 08/03/2014, 22:20
... Certified Open Source: Pythonline http://www.pythonline.com/ Dive Into <b>Python</b> http://diveintopython.org/ Dive Into <b>Python</b>. <b>Python</b> from ... of Python you are using. 3. Double-click the installer. If you download PyXML 0.8 .3 for Windows and Python 2 .3, the installer program will be PyXML-0.8 .3. win32- py2 .3. exe. 4. Step thr...
Ngày tải lên: 17/10/2013, 19:15
Dive Into Python-Chapter 13. Unit Testing
... (34 08, 'MMMCDVIII'), (35 01, 'MMMDI'), (36 10, 'MMMDCX'), (37 43, 'MMMDCCXLIII'), (38 44, 'MMMDCCCXLIV'), (38 88, 'MMMDCCCLXXXVIII'), (39 40, ... (34 08, 'MMMCDVIII'), (35 01, 'MMMDI'), (36 10, 'MMMDCX'), (37 43, 'MMMDCCXLIII'), (38 44, 'MMMDCCCXLIV'), (38 88, 'MMMDCCCLXXXVIII&a...
Ngày tải lên: 20/10/2013, 10:15
Dive Into Python-Chapter 14. Test-First Programming
... Traceback (most recent call last): File "C:\docbook\dip\py\roman\stage1\romantest1.py", line 133 , in testMalformedAntecedent self.assertRaises(roman1.InvalidRomanNumeralError, roman1.fromRoman, ... "C:\docbook\dip\py\roman\stage1\romantest1.py", line 93, in testToRomanKnownValues self.assertEqual(numeral, result) File "c:\python21\lib\unittest.py", line 2 73, in...
Ngày tải lên: 20/10/2013, 10:15
Dive Into Python-Chapter 15. Refactoring
... (34 08, 'MMMCDVIII'), (35 01, 'MMMDI'), (36 10, 'MMMDCX'), (37 43, 'MMMDCCXLIII'), (38 44, 'MMMDCCCXLIV'), (38 88, 'MMMDCCCLXXXVIII'), (39 40, ... (27 23, 'MMDCCXXIII'), (2892, 'MMDCCCXCII'), (2975, 'MMCMLXXV'), (30 51, 'MMMLI'), (31 85, 'MMMCLXXXV'), (32 50, 'MMMCCL'), (33...
Ngày tải lên: 24/10/2013, 09:15
Dive Into Python-Chapter 16. Functional Programming
... sys.argv[0] = /home/you/diveintopython/common/py/fullpath.py path = /home/you/diveintopython/common/py full path = /home/you/diveintopython/common/py [you@localhost diveintopython]$ python common/py/fullpath.py ... /home/you/diveintopython/common/py [you@localhost diveintopython]$ cd common/py [you@localhost py]$ python fullpath.py 3 sys.argv[0] = fullpath.py path = full path = /home/you/di...
Ngày tải lên: 24/10/2013, 09:15
Dive Into Python-Chapter 17. Dynamic functions
... find a, b, or c, and replace it with o. Mark becomes Mork. 3 The same function turns rock into rook. 4 You might think this would turn caps into oaps, but it doesn't. re.sub replaces all of ... not just the first one. So this regular expression turns caps into oops, because both the c and the a get turned into o. Example 17 .3. Back to plural1.py import re def plural(noun): if...
Ngày tải lên: 28/10/2013, 16:15
Dive Into Python-Chapter 18. Performance Tuning
... "import soundex") 1 >>> t.timeit() 2 8.216 837 335 47 >>> t.repeat (3, 2000000) 3 [16.4 831 930 9109, 16.461289849 23, 16.442 039 48912] 1 The timeit module defines one class, Timer, ... C:\samples\soundex\stage1>python soundex1c.py Woo W000 14. 534 834 734 6 Pilgrim P426 19.27847 030 84 Flingjingwaller F452 30 .08 938 733 83 But is this the wrong path? The...
Ngày tải lên: 28/10/2013, 16:15
Dive Into Python-Chapter 1. Installing Python
... >>> [press Ctrl+D to exit] [root@localhost root]# python2 .3 Python 2 .3 (#1, Sep 12 20 03, 10: 53: 56) [GCC 3. 2.2 20 030 222 (Red Hat Linux 3. 2.2-5)] on linux2 Type "help", "copyright", ... ... localhost:~/Python-2 .3# exit logout localhost:~$ which python /usr/local/bin/python localhost:~$ python Python 2 .3. 1 (#2, Sep 24 20 03, 11 :39 :14) [GCC 3. 3.2 2...
Ngày tải lên: 07/11/2013, 10:15