Python Code Samples



Filters


python base64 encode and decode a string
kishore_kumar | 6 years, 3 months
import base64

str1 = "koderplace"
python base64
How to access django models in stand alone python script without manage.py
kishore_kumar | 6 years, 1 month
import os
import django

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

python redis
convert python date time object to specific format using strftime
kishore_kumar | 6 years, 2 months
import datetime

st = "2019-08-19 05:40"
python datetime
How to load a pickle file in python
harika | 6 years, 1 month
with open('train.pickle', 'rb') as f:
    X_train, y_train = pickle.load(f)
python pickle file
Remove directory / folder in python
harika | 6 years, 8 months
'''
You can remove empty directory by rmdir function.
But to remove non empty directory we have to
Shuttle : A module that offers a number of high-level operations on files and collections of files.
shutil python os
how to extract text content from pdf file using python
kishore_kumar | 6 years, 8 months
from tika import parser # pip install tika

process = parser.from_file('/path/to/my.pdf')
python tika
Image labels detection using google Vision API in python
kishore_kumar | 6 years, 8 months
from google.cloud import vision
from google.cloud.vision import types

If you setup env variable with export GOOGLE_APPLICATION_CREDENTIALS="/file/creds.json" then you ca
python google vision
send mail using sendgrid python
kishore_kumar | 6 years, 3 months
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
python sendgrid
How to dump data to a pickle file in python
harika | 6 years, 1 month
X_train = []
y_train = []
with open('train.pickle', 'wb') as f:
python pickle file
Prev Next