/Python-Notes

the python code needed for sending email, get file from ftp server, etc

Primary LanguagePython

Welcome to the Python-Notes wiki!

Here are some python programming notes I made when dealing with some interesting situations in programming.

Enjoy!

Email

  1. Package: smtplib
  2. References:

SFTP Service

  1. Package: pysftp
  2. References:

Exception Handling

  1. Python Handling Exception
  2. Example:
(x,y) = (5,0)
try:
   z=x/y
except ZeroDivisionError:
   print "divide by zero"

Task Scheduling

  1. Package/Tool: crontab
  2. References:
  3. Example:
minute(0-59) hour(0-23) day(1-31) month(1-12) weekday(0-6) command

MD5 Check

  1. Package/Tool: md5sum or hashlib.md5()
  2. References:
  3. Example:
    • md5sum:
    md5sum file
    • hashlib.md5():
    hashlib.md5(open(file,'r').read()).hexdigest() 

PGP Encrption/Decryption

  1. Package/Tool: gnupg
  2. References: