Python Code Samples



Filters


get binary code for an integer in python
kishore_kumar | 5 years, 2 months
n = 115

b_n = bin(n)
python binary
Parsing JSON file
Reshma | 5 years, 2 months
import json
x='{"a":1,"b":2,"c":3}'
y=json.loads(x)
python json parsing
Ramya
Python program to print pattern
Ramya | 5 years, 3 months
for i in range (6,1,-1):
	for j in range (i):
		print ("*",end= "")
python pattern
Custom Exception writing in python
kishore_kumar | 5 years, 2 months
class MinLengthError(Exception):
    def __init__(self, message, errors):
        super().__init__
Enter a word: hello hello is valid Enter a word: one Required min length: 4 {'inpt': 'on
python exception
connect to redis and get values using python
kishore_kumar | 4 years, 10 months
import redis # pip install redis
r = redis.Redis(host='localhost', port='6379')

python redis
How to write python dictionary to csv file with header
kishore_kumar | 5 years, 2 months
improt csv

data = [
python csv
Ramya
Word search inside multiple files
Ramya | 5 years
import os
search_path = input("Enter directory path to search : ")
file_type = input("File Type : 
python
how to use format function extensively with strings in python
harika | 5 years, 8 months
a = 5
b = 10
c = 15
python
durga
Exception Handling in python
durga | 5 years, 3 months
x=input("enter x: ")
y=input("enter y: ")
try: 
python
get time between dates for each day
kishore_kumar | 1 year
from datetime import datetime, timedelta


python datetime
Prev Next