Python Code Samples



Filters


Draw subplots in matplotlib
harika | 5 years, 9 months
import matplotlib.pyplot as plt
plt.figure(1)
plt.subplot(211)
You can see the output in the attached image. If you want to play with plot then set specific prope
python matplotlib
POST request in python using requests
kishore_kumar | 6 years
import requests

url = "https://httpbin.org/post"
url can be your API/service URL for your request.
python python-requests
How to get Django avatar in views or models
kishore_kumar | 5 years, 9 months
django.contrib.auth.models import User
from avatar.templatetags.avatar_tags import avatar_url

python django-avatar
Create a line chart using python matplotlib
kishore_kumar | 5 years, 11 months
import matplotlib.pyplot as plt

t = ['12-03-18','12-04-18' , '12-05-18', '12-06-18', '12-07-18']
python matplotlib
durga
Finding Character in a String python
durga | 5 years, 4 months
S1=raw_input("enter String")
S2=raw_input("enter character")
S1=S1.upper() #we are changing into u
We can use lower() also, But both the strings should be changed into the same case(upper/lower).
python string in operator
get date ctime from python datetime
kishore_kumar | 5 years, 4 months
import datetime

today = datetime.date.today()
python datetime
Generate Pie Chart in python using matplotlib
kishore_kumar | 6 years
import matplotlib.pyplot as plt

labels = 'Grapes', 'Oranges', 'Mangoes', 'Apples'
python matplotlib
Using python generator for finding factors
kishore_kumar | 5 years, 3 months
def get_factors(num):
    i = 1
    while i * i < num:
python generator factors
How to get number of queries executed in Django orm
kishore_kumar | 5 years, 2 months
from django.db import connection

tasks = Task.objects.all()
python django django-orm
Draw a basic plot using matplotlib
harika | 5 years, 9 months
import matplotlib.pyplot as plt
import numpy as np
ar = np.arange(0, 5, 0.2)
python matplotlib
Prev Next