View select_file_tk.py
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
import tkinter as tk | |
from tkinter import filedialog | |
root = tk.Tk() | |
root.withdraw() | |
file_path = filedialog.askopenfilename() | |
print(file_path) |
View excel_to_list.py
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
import xlrd | |
import sys | |
class ExcelToList(): | |
def __init__(self, file, sheet): | |
self.file = file | |
self.sheet = sheet | |
def convert(self): |
View extended_ip_address_info.py
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
#!/bin/python | |
# -*- coding: utf-8 -*- | |
# Using curl to get data from https://ipinfo.io/json | |
# Template from pycurl documentation | |
# http://pycurl.io/docs/latest/quickstart.html#examining-response-headers | |
import pycurl #curl library | |
import certifi #HTTP over TLS/SSL library | |
from io import BytesIO #Buffered I/O implementation using an in-memory bytes buffer. |
View Combine excel files into 1.py
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
from openpyxl import load_workbook | |
from openpyxl import Workbook | |
import os | |
# Read data from active worksheet and return it as a list | |
def reader(file): | |
global path | |
abs_file = os.path.join(path, file) | |
wb_sheet = load_workbook(abs_file).active |
View Directory Organizer.py
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
#!/usr/bin/python3 | |
import argparse | |
import os | |
def path(): | |
parse = argparse.ArgumentParser( | |
add_help=True, description="Organize your files to different directories according to their type") | |
parse.add_argument('directory_path', type=str, default='./', |
View Current City Weather.py
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
import requests | |
def get_temperature(json_data): | |
temp_in_celcius = json_data['main']['temp'] | |
return temp_in_celcius | |
def get_weather_type(json_data): | |
weather_type = json_data['weather'][0]['description'] | |
return weather_type |
View CSV to Excel.py
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
#!python3 | |
# -*- coding: utf-8 -*- | |
import openpyxl | |
import sys | |
#inputs | |
print("This programme writes the data in any Comma-separated value file (such as: .csv or .data) to a Excel file.") | |
print("The input and output files must be in the same directory of the python file for the programme to work.\n") |
View cricbuzz.py
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
from urllib.request import urlopen | |
from bs4 import BeautifulSoup | |
quote_page = 'http://www.cricbuzz.com/cricket-match/live-scores' | |
page = urlopen(quote_page) | |
soup = BeautifulSoup(page,'html.parser') | |
update=[] | |
for score in soup.find_all('div',attrs={'class':'cb-col cb-col-100 cb-lv-main'}): |
View color-to-bw.py
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
import sys | |
from PIL import Image | |
from PIL.ExifTags import TAGS | |
image_file = sys.argv[1] | |
image_name = image_file.split(".")[0] | |
try: | |
image = Image.open(image_file) | |
except IOError: |
View Cryptocurrency Prices.py
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
#!python3 | |
# -*- coding: utf-8 -*- | |
import requests | |
from bs4 import BeautifulSoup | |
from colorama import init, Fore, Back, Style | |
import sys | |
import os | |
#get the price |