Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Harendra Kumar Kanojiya harendra21

🏠
Working from home
View GitHub Profile
View select_file_tk.py
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
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
#!/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
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
#!/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
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
#!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
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
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
#!python3
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
from colorama import init, Fore, Back, Style
import sys
import os
#get the price