226 CHAPTER 10 BATTERIES INCLUDED (Jetty web server) The reason
Saturday, May 31st, 2008226 CHAPTER 10 BATTERIES INCLUDED The reason for the usefulness of the deque is that it allows appending and popping efficiently at the beginning (to the left), as opposed to lists. As a nice side effect, you can also rotate the elements (that is, shift them to the right or left, wrapping around the ends) efficiently. Deque objects also have extendand extendleft methods, with extend working like the corresponding list method, and extendleft working analogously to appendleft. Note that the elements in the iterable used in extendleft will appear in the deque in reverse order. time The time module contains functions for, among other things, getting the current time, manipulating times and dates, and reading dates from strings and formatting dates as strings. Dates can be represented as either a real number (the seconds since 0 hours, January 1 in the epoch, a platform-dependent year; for UNIX, it s 1970), or a tuple containing nine integers. These integers are explained in Table 10-5. For example, the tuple (2002, 1, 21, 12, 2, 56, 0, 21, 0) represents January 21, 2002, at 12:02:56, which is a Monday, and the 21st day of the year. (No daylight savings.) Table 10-5. The Fields of Python Date Tuples Index Field Value 0 Year For example, 2000, 2001, and so on 1 Month In the range 1 12 2 Day In the range 1 31 3 Hour In the range 0 23 4 Minute In the range 0 59 5 Second In the range 0 61 6 Weekday In the range 0 6, where Monday is 0 7 Julian day In the range 1 366 8 Daylight Savings 0, 1, or 1 Some of these values need some explaining: The range for seconds is 0 61 to account for leap seconds and double leap seconds. The Daylight Savings number is a Boolean value (true or false), but if you use 1, mktime (a function that converts such a tuple to a timestamp measured in seconds since the epoch) will probably get it right. Some of the most important functions in the timemodule are described in Table 10-6.
Check Tomcat Web Hosting services for best quality webspace to host your web application.