Chapter 11, Handling Emails Using Python Scripting

  1. In computing, the Post Office Protocol is an application-layer internet standard protocol used by email clients to retrieve email from a mail server. POP version 3 is the version in common use. The Internet Message Access Protocol (IMAP) is an internet standard protocol used by email clients to retrieve email messages from a mail server over a TCP/IP connection. IMAP is defined by RFC 3501.
  2. The break statement terminates the loop containing it. Control of the program flows to the statement immediately after the body of the loop. If a break statement is inside a nested loop (a loop inside another loop), the break will terminate the innermost loop. Here's an example:
for val in "string":
if val == "i":
break
print(val)
print("The end")
  1. The continue statement is used to skip the rest of the code inside a loop for the current iteration only. The loop does not terminate but continues on with the next iteration:
for val in "string":
if val == "i":
continue
print(val)
print("The end")
  1. The pprint module provides a capability to pretty-print arbitrary Python data structures in a form that can be used as input to the interpreter. If the formatted structures include objects that are not fundamental Python types, the representation may not be loadable. This may be the case if objects such as files, sockets, classes, or instances are included, as well as many other built-in objects that are not representable as Python constants.
  2. A negative index is used in Python to index starting from the last element of the list, tuple, or any other container class that supports indexing. -1 refers to the last index, -2 refers to the second last index, and so on.
  1. Python compiles the .py files and saves them as .pyc files , so it can reference them in subsequent invocations. .pyc contains the compiled bytecode of Python source files. .pyc contains the compiled bytecode of Python source files, which is what the Python interpreter compiles the source to. This code is then executed by Python's virtual machine . There's no harm in deleting them .pyc, but they will save compilation time if you're doing lots of processing.
  2. Following is the answer:
num = 7
for index in range(num,0,-1):
if index % 2 != 0:
for row in range(0,num-index):
print(end=" ")
for row in range(0,index):
if row % 2== 0:
print("1",end=" ")
else:
print("0",end=" ")
print()
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset