This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RateCalculator.py | |
# Python 2.7.6 | |
""" | |
A python program that makes use of decorator. Our imaginary software | |
consultant/ contractor uses this program to generate invoice for his | |
various services | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python 2.7.6 | |
# myDecorator.py | |
""" | |
A simple decorator example in python | |
""" | |
class SimpleClass: | |
""" | |
A simple class with add and subtract methods, undecorated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python 2.7.6 | |
# extractXmlFromXl.py | |
""" | |
Script to download all xml files from the urls specified in the excel report | |
Requires requests and openpyxl modules | |
""" | |
import requests | |
from requests.auth import HTTPDigestAuth # To access url with digest authentication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tktk.py | |
# Python 2.7.6 | |
""" | |
A simple form that prompts for name and prints it back | |
""" | |
import Tkinter as tk # use "tkinter" for python 3.x | |
# All widgets belong to a parent which is defined first |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pptPlay.py | |
# Python 2.76 | |
# Importing python-pptx module | |
from pptx import Presentation | |
# This is the template based on which PPT will be created | |
# If None is passed then blank ppt with no slides will be created | |
PPT_TEMPLATE = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Python 2.7.6 | |
#CombinePDF_Py2.py | |
#Gets raw_inputs of 2 PDF file names from user and combines them into 1 | |
import PyPDF2 | |
import os | |
def getFileNameFromUser (file, path): | |
pdf_file_name = raw_input("Enter {0} name: ".format(file)) | |
if pdf_file_name in os.listdir(path): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Python 2.7.6 | |
#DemergePDF.py | |
#Gets raw_inputs of 1 PDF file names from user and demerge into 2 | |
import PyPDF2 | |
import os | |
def getFileNameFromUser (file, path): | |
pdf_file_name = raw_input("Enter {0} name: ".format(file)) | |
if pdf_file_name in os.listdir(path): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# persistListOfDicts.py | |
# Python 2.7.6 | |
import json | |
import os | |
json_path = "./JSON" | |
# Write dicts into a pickle file each |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logger.py | |
# Python2.7.6 | |
# For more details - https://docs.python.org/3/howto/logging.html#logging-basic-tutorial | |
# logging.error - just displays the error message | |
# logging.exception - displays the stack trace along with the error message | |
import logging # For logs | |
import sys # To read parameters from command line | |
# Define the format of the logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# persistListOfDicts.py | |
# Python 2.7.6 | |
import json | |
import os | |
import pickle # To persist each dict | |
json_path = "./JSON" | |