Python Code Samples



Filters


unzip file from gz files using python
kishore_kumar | 5 years, 8 months
import gzip
import shutil
with gzip.open('my_file.gz', 'rb') as f_in:
python gzip
round a floating point number in python
kishore_kumar | 6 years, 7 months
my_number = 123.83725

print round(my_number, 2) # 123.84
python
Python logging basic example to print from debug
kishore_kumar | 5 years, 9 months
import logging
logging.basicConfig(level=logging.DEBUG)

python logging
Text identification in the image using google vision API with python
kishore_kumar | 6 years, 3 months
from google.cloud import vision
from google.cloud.vision import types

python google vision
Ramya
Indexed DataFrame using list of dictionaries
Ramya | 5 years, 11 months
import pandas as pd
data = [{'Python': 90, 'C': 84,'java':65},{'Python': 78, 'C': 90, 'java': 65}]
python pandas dataframe
Simple singly Linked List in python
kishore_kumar | 6 years, 4 months
class Node(object):
    def __init__(self, data=None, next_node=None):
        self.data = data
python linked list
Save full traceback from exception in python
kishore_kumar | 5 years, 9 months
import traceback

l = [1,2,3]
python exception
python base64 encode and decode a string
kishore_kumar | 5 years, 12 months
import base64

str1 = "koderplace"
python base64
get all keys from redis with python
kishore_kumar | 5 years, 6 months
import redis # pip install redis
r = redis.Redis(host='localhost', port='6379')

python redis
Python pickle dump
Reshma | 5 years, 7 months
import pickle

number_of_data = int(input('Enter the number of data : '))
python pickle dump
Prev Next