Python Code Samples



Filters


durga
Writing into files in python
durga | 6 years, 7 months
file = open('open.txt','w') 
 
file.write('Hi there!') 
python file handling
convert python date time object to specific format using strftime
kishore_kumar | 6 years, 6 months
import datetime

st = "2019-08-19 05:40"
python datetime
python base64 encode and decode a string
kishore_kumar | 6 years, 8 months
import base64

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

python redis
How to load a pickle file in python
harika | 6 years, 5 months
with open('train.pickle', 'rb') as f:
    X_train, y_train = pickle.load(f)
python pickle file
Remove directory / folder in python
harika | 7 years, 1 month
'''
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
Image labels detection using google Vision API in python
kishore_kumar | 7 years
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
how to extract text content from pdf file using python
kishore_kumar | 7 years, 1 month
from tika import parser # pip install tika

process = parser.from_file('/path/to/my.pdf')
python tika
send mail using sendgrid python
kishore_kumar | 6 years, 7 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, 5 months
X_train = []
y_train = []
with open('train.pickle', 'wb') as f:
python pickle file
Prev Next