This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import md5 | |
f = open("newmd5.py","r+") | |
b = md5.md5(f.read()) | |
# MD5 of the parent: 54062bcee8cdff7b3c3124421f5c5018 Last Modified:2011-11-21 23:28:46.974856 | |
f.seek(60) | |
import datetime | |
digest = b.hexdigest() | |
f.writelines("# MD5 of the parent: "+digest+" Last Modified:"+str(datetime.datetime.now())) | |
print digest | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
f = open("choice.py","r+") | |
i = 1###########This Number will get replaced | |
print "%s times" % (i) | |
f.seek(41) | |
c = f.readline() | |
m = re.match('\d+',c) | |
f.seek(41) | |
f.write(str(int(m.group())+1)) | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class സൂചിക: | |
""" | |
മലയാളത്തിൽ പൈതോണ് കോഡ് ചെയ്യാം എന്നുള്ളതിനുള്ള തെളിവ് | |
Proof that python can use malayalam language (Only on Python 3x) | |
""" | |
def സൂചിക(സ്വയം): | |
print(u"പൈതോണ് ഇപ്പോൾ മലയാളത്തിലും !") | |
സൂചി = സൂചിക() | |
സൂചി.സൂചിക() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A simple implementation of a greedy transition-based parser. Released under BSD license.""" | |
from os import path | |
import os | |
import sys | |
from collections import defaultdict | |
import random | |
import time | |
import pickle | |
SHIFT = 0; RIGHT = 1; LEFT = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import Flask object from flask library | |
# you can install flask by pip install flask | |
from flask import Flask | |
# initialize Flask app with the name of the file | |
app = Flask(__name__) | |
# define the url for which the application should send an http response to | |
@app.route('/') | |
# plain python function to handle the request | |
def hello_world(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WaterBottle(object): | |
def __init__(self): | |
self.water = 100 | |
self.max_capacity = 500 | |
self.make = "Plastic" | |
def add_water(self, amount): | |
if self.max_capacity < self.water + amount: | |
self.water = self.max_capacity | |
print "OverFlow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WineBottle(object): | |
def __init__(self): | |
self.wine = 100 | |
self.max_capacity = 500 | |
self.make = "Plastic" | |
def add_wine(self, amount): | |
if self.max_capacity < self.wine + amount: | |
self.wine = self.max_capacity | |
print "OverFlow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bottle(object): | |
def __init__(self): | |
self.liquid = 100 | |
self.name = "" | |
self.max_capacity = 500 | |
self.make = "Plastic" | |
def print_details(bottle): | |
print bottle.liquid, bottle.name, bottle.max_capacity, bottle.make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b = WaterBottle() | |
b.add_water(300) | |
b.drink_water(200) | |
b.drink_water(700) | |
b = WineBottle() | |
b.add_wine(300) | |
b.drink_wine(200) | |
b.drink_wine(700) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#add this to your urls file | |
url(r'^version/$', 'api.views.code_version', name='code_version'), |
OlderNewer