This file contains 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" | |
This file contains 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 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 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 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 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 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 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
# gistsDownloader.py | |
# Python 3.4 | |
import requests | |
username = "vinovator" | |
url = "https://api.github.com/users/" + username + "/gists" | |
resp = requests.get(url) |
This file contains 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
# keywordExtractor.py | |
# Python 2.7.6 | |
import requests | |
import re | |
from collections import Counter | |
""" | |
Step 1: Obtain Text | |
Step 2: Strip punctuation, special characters, etc. |
This file contains 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 | |
# Cricinfoscraper_py2.py | |
""" | |
Simple webscraper to download cartoons from cricinfo site. | |
The url is http://www.espncricinfo.com/ci/content/story/author.html?author=333 | |
Changed the code to dynamically scroll the page to fetch more cartoons. | |
Using Splinter/ Selenium library to fetch javascript rendered content | |
""" |