Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/linrakesh/python
Browse files Browse the repository at this point in the history
  • Loading branch information
linrakesh committed Dec 1, 2019
2 parents 8bcc213 + 0c788d2 commit 808e9bb
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 19 deletions.
2 changes: 1 addition & 1 deletion comm_code.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# purpose : write a program to read a list and convert that list into comma seperated string
# author : rakesh kumar
# licence : MIT
spam =['apples','banana','oranges','mango']
spam =['apples','banana','oranges','mango','kivi','cheeku','pine apple','strawberries']
string =''
n = len(spam)
for i in range(1,n):
Expand Down
4 changes: 2 additions & 2 deletions database/delete_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#-------------------------------------------------------------------------------

import MySQLdb
db = MySQLdb.connect("localhost","root","","cable")
db = MySQLdb.connect("localhost","root","","binarynote")
cursor = db.cursor()
name = input("Enter any name : ")
sql ="delete from customer where name like '%" + name + "';"
sql ="delete from user where uname like '%" + name + "';"
cursor.execute(sql)
db.commit()
db.close()
Expand Down
1 change: 1 addition & 0 deletions fileHandling/delete_duplicate_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import glob
import tkinter as tk
from tkinter import filedialog

count=0
root = tk.Tk()
root.withdraw()
Expand Down
31 changes: 21 additions & 10 deletions fileHandling/folderManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,48 @@
# made by : rakesh kumar
# last compiled on : 30/11/2019


import os
import os.path
from os import path
import sys
import shutil
import tkinter as tk
from tkinter import filedialog
import tkinter.messagebox

source = r'C:\Users\rakesh\Documents'

filetype = {'docs': ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'rtf', 'odf', 'odt'],
'pdf': ['pdf'],
'img': ['jpg', 'jpeg', 'png', 'gif', 'bmp'],
'exe': ['zip', 'rar', 'exe'],
'prg': ['py', 'cpp', 'php'],
'music': ['mp3', 'mp4', 'mkv', 'wmv', '3gp', 'avi', 'mov', 'aac', 'flv', 'ogg', 'ogb', 'yuv', 'mpg']
'music': ['mp3', 'mp4', 'mkv', 'wmv', '3gp', 'avi', 'mov', 'aac', 'flv', 'mpg']
}


def filemove(file, filetype, key):
if(file.split('.')[1]) in filetype[key]:
if (os.path.exists(source+'/'+key) == False):
os.mkdir(source+'/'+key)
elif(path.isfile(source+'/'+key)):
os.mkdir(source+'/'+key)
if (os.path.exists(sourcedir+'/'+key) == False):
os.mkdir(sourcedir+'/'+key)
elif(path.isfile(sourcedir+'/'+key)):
os.mkdir(sourcedir+'/'+key)
try:
shutil.move(root + "/"+file, source+'/'+key)
shutil.move(sourcedir + "/"+file, sourcedir+'/'+key)
except:
pass


for root, folder, files in os.walk(source):
root = tk.Tk()
root.withdraw()
sourcedir = filedialog.askdirectory() # source folder
if not sourcedir.strip():
print("Folder Error...User did not selected any folder")
#rootdir = 'C:\\Users\\ace
sys.exit()

for root, folder, files in os.walk(sourcedir):
for file in files:
for key in filetype.keys():
if(file.split('.')[1]) in filetype[key]:
filemove(file, filetype, key)

tkinter.messagebox.showinfo('Folder Manager', 'Please check your Folde now')
17 changes: 16 additions & 1 deletion functions/recursion/natutal_no.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,20 @@ def natural(n):
else:
print(n)
return natural(n-1)


def natural1(n):
if n == 100:
print(100)
return
else:
print(n)
return natural(n+1)
# function call to print 100 natural no


# function call to print 100 natural no
natural(100)

natural(1)
#natural(100)

4 changes: 2 additions & 2 deletions hello.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
if __name__ == '__main__':
for i in range(1,101,3):
print(i)
for i in range(1,24,3):
print(i)
1 change: 1 addition & 0 deletions tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_list
3 changes: 0 additions & 3 deletions turtle.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import tkinter
from turtle import *
color('red', 'yellow')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
done()


Expand Down
Binary file modified welcome.mp3
Binary file not shown.

0 comments on commit 808e9bb

Please sign in to comment.