-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
374 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class student(): | ||
name = "rakesh" | ||
website ="binarynote.com" | ||
expertise ="PHP, CSS, HTML,JavaScript,JQuery,WordPress and Now Python Django" | ||
|
||
def showMessage(self): | ||
print("This is a demo message from class ") | ||
|
||
s = student() | ||
|
||
print("Default Behaviour of Class Members in Python\n\n\nName : ",s.name) | ||
print("website : ", s.website) | ||
print("Expertise :", s.expertise,"\n") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class student(): | ||
name = "rakesh" | ||
website ="binarynote.com" | ||
expertise ="PHP, CSS, HTML,JavaScript,JQuery,WordPress and Now Python Django" | ||
|
||
def setData(self,name,web,exp): | ||
self.name = name | ||
self.website = web | ||
self.expertise = exp | ||
|
||
def showData(self): | ||
print("Name : ",self.name) | ||
print("website : ", self.website) | ||
print("Expertise :", self.expertise,"\n") | ||
|
||
#object creation | ||
s = student() | ||
s.showData() | ||
|
||
# set new Data using another function | ||
s.setData("Swarnima", 'swarnima.com','Python, Django, CSS, JavaScript') | ||
s.showData() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class student(): | ||
name="" | ||
website="" | ||
expertise="" | ||
|
||
def __init__(self): | ||
self.name ="swarnima" | ||
self.website = "http://www.swarnima.com" | ||
self.expertise ="Django Specialist" | ||
|
||
def showData(self): | ||
print("Name : ",self.name) | ||
print("website : ", self.website) | ||
print("Expertise :", self.expertise,"\n") | ||
|
||
#object creation | ||
# | ||
|
||
s1 = student() #calling constructor | ||
s1.showData() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class student: | ||
def read_data(self,name,fatherName,stream): | ||
self.name = name | ||
self.fatherName = fatherName | ||
self.stream = stream | ||
|
||
def show_data(self): | ||
print("Student Name ",self.name) | ||
print("father Name ",self.fatherName) | ||
print("Stream Name ",self.stream) | ||
|
||
s = student() | ||
s.read_data('rakesh','jagdish','computer') | ||
s.show_data() |
File renamed without changes.
File renamed without changes.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
|
||
#------------------------------------------------------------------------------- | ||
import MySQLdb | ||
|
||
|
||
# Open database connection | ||
db = MySQLdb.connect("localhost","root","ramji","cable" ) | ||
|
||
# prepare a cursor object using cursor() method | ||
cursor = db.cursor() | ||
|
||
# execute SQL query using execute() method. | ||
cursor.execute("SELECT VERSION()") | ||
|
||
# Fetch a single row using fetchone() method. | ||
data = cursor.fetchone() | ||
print("Database version : %s " % data ) | ||
|
||
# disconnect from server | ||
db.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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sum = 0 | ||
for i in range(10): | ||
try: | ||
if 10 / i == 2: | ||
break | ||
except ZeroDivisionError: | ||
sum = sum+1 | ||
else: | ||
sum = sum +2 | ||
print("Sum :",sum) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
file = open(r"C:\Users\acer\Desktop\pythonPrograms\fileHandling\abcd.txt",'r') | ||
file = open(r"C:\Users\acer\Desktop\PythonBox\pythonPrograms\fileHandling\abcd.txt",'r') | ||
data1 = file.read() | ||
print(data1) | ||
file.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import os | ||
path = r"C:\Users\acer\Desktop\PythonBox\python_video" | ||
os.chdir(path) | ||
for file in os.listdir(): | ||
if os.path.isfile(file): | ||
filename,ext = os.path.splitext(file) | ||
files = filename.split(' ') #now filenames in tuples | ||
newname = files[4] + '-'.join(files[5:])+ext | ||
#print(newname) | ||
os.rename(file,newname) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def front3(str): | ||
str1 = str[:3]*3 | ||
print(str1) | ||
|
||
front3('java') | ||
front3('Chocolate') | ||
front3('ab') | ||
front3('a') | ||
front3('') |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def factorial(): | ||
n = int(input("Enter any number ")) | ||
fact = 1 | ||
for i in range(1,n+1): | ||
fact *= i | ||
print("Factorial of ", n ," is :",fact) | ||
|
||
#function call | ||
factorial() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def factorial(n): | ||
fact = 1 | ||
for i in range(1,n+1): | ||
fact *= i | ||
print("Factorial of ", n ," is :",fact) | ||
|
||
#function call | ||
n = int(input("Enter any number ")) | ||
factorial(n) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
def factorial(n): | ||
if n==1: | ||
return 1 | ||
else: | ||
return n*(factorial(n-1)) | ||
|
||
#function call | ||
n = int(input("Enter any number ")) | ||
result = factorial(n) | ||
print("factorial of {} is {} ".format(n,result)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from bs4 import BeautifulSoup | ||
from random import randint | ||
import urllib | ||
import pynotify | ||
import time | ||
|
||
|
||
def sendMessage(title, message): | ||
pynotify.init("Test") | ||
notice = pynotify.Notification(title, message) | ||
notice.show() | ||
return | ||
|
||
webpage = urllib.urlopen('https://quizlet.com/58647605/kaplan-900-flash-cards').read() | ||
|
||
# Parse the entire webpage | ||
soup = BeautifulSoup(webpage) | ||
|
||
word = [] | ||
meaning = [] | ||
|
||
# Scrape words from soup | ||
for words in soup.find_all("span", class_="TermText qWord lang-en"): | ||
# Convert ascii to string | ||
word.append(words.text.encode("utf-8")) | ||
|
||
# Scrape meanings from soup | ||
for meanings in soup.find_all("span", class_="TermText qDef lang-en"): | ||
meaning.append(meanings.text.encode("utf-8")) | ||
|
||
print("Churning words !") | ||
|
||
|
||
while(1): | ||
index = randint(0,700) | ||
print(index) | ||
# First just pop the word on screen to wait for response | ||
sendMessage(word[index],"") | ||
# Adjust the response time between word and its meaning | ||
time.sleep(15) | ||
# Display the meaning with the word | ||
sendMessage(word[index], meaning[index]) | ||
# Time after which a new word pops on screen | ||
time.sleep(600) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
list = [1, 1, 2, 3,[5,6], ["anil","Rahul"],5, 8, 13] | ||
print(list[5][0]) | ||
|
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
a,b,c = 10,20,30 | ||
print("\n Multiple assignment operator \n a = {} \n B = {} \n c= {}".format(a,b,c)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
-*- coding: utf-8 -*- | ||
======================== | ||
Python Desktop News Notifier | ||
======================== | ||
Developed by: Chirag Rathod (Srce Cde) | ||
Email: chiragr83@gmail.com | ||
======================== | ||
""" | ||
|
||
import feedparser | ||
import notify2 | ||
import time | ||
import os | ||
|
||
|
||
def Parsefeed(): | ||
f = feedparser.parse("http://feeds.bbci.co.uk/news/rss.xml") | ||
ICON_PATH = os.getcwd() + "/icon.ico" | ||
notify2.init('News Notify') | ||
|
||
for newsitem in f['items']: | ||
print(newsitem['title']) | ||
print(newsitem['summary']) | ||
print('\n') | ||
|
||
n = notify2.Notification(newsitem['title'], | ||
newsitem['summary'], | ||
icon=ICON_PATH | ||
) | ||
|
||
n.set_urgency(notify2.URGENCY_NORMAL) | ||
n.show() | ||
n.set_timeout(15000) | ||
time.sleep(1200) | ||
|
||
|
||
if __name__ == '__main__': | ||
try: | ||
Parsefeed() | ||
except: | ||
print("Error") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import re | ||
phoneNumRegex = re.compile(r'\d\d\d-\d\d\d-\d\d\d\d') | ||
mo = phoneNumRegex.search('My number is 415-555-4242.') | ||
print('Phone number found: ' + mo.group()) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
str = "This is original string" | ||
rev = ''.join(reversed(str)) | ||
print(rev) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pi = 3.14 | ||
##text = 'The value of pi is ' + pi ## NO, does not work | ||
text = 'The value of pi is ' + str(pi) ## yes | ||
print(text) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
str = ''' Python has a built-in string class named "str" with many handy | ||
features (there is an older module named "string" which you | ||
should not use Python. String literals can be enclosed | ||
by either double or single quotes, | ||
although single quotes are more commonly used ''' | ||
|
||
print("String length :", len(str)) | ||
upper = str.upper() | ||
print("String in upper case : ") | ||
print(upper) | ||
|
||
lower = upper.lower() | ||
print("\n\nString in lower case :", lower) | ||
|
||
strip = str.strip() | ||
print("\n\nString without space at begining and end :", strip) | ||
|
||
startwith = str.startswith('python') #return true or fals | ||
endwith = str.endswith('hello') | ||
print(startwith) | ||
print(endwith) | ||
|
||
find = str.find('quotes') # display the index of first occurance of the string | ||
print("First appeared at :",find) | ||
|
||
newstr = str.replace('Python','c++') | ||
print("\n\n New string where 'Python' was replaced with 'C++' \n", newstr) | ||
|
||
split = str.split(' ') # return result in a list | ||
print(split) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
str = "This is me rakesh" | ||
n = len(str) | ||
print('Length of string is : ',n) | ||
str = str + "Hello rakesh" | ||
print(str) | ||
print(str[0]) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from turtle import * | ||
color('red', 'yellow') | ||
begin_fill() | ||
while True: | ||
forward(200) | ||
left(170) | ||
if abs(pos()) < 1: | ||
break | ||
end_fill() | ||
done() |
Oops, something went wrong.