All Programs of Python PDF
All Programs of Python PDF
All Programs of Python PDF
a=10
b=20
c=a+b
print("Addition is : ",a+b)
print("Subtraction is : ",a-b)
print("Multiplication is : ",a*b)
print("Division is : ",a/b)
print(a," is greater")
print(b," is greater")
print(c," is greater")
else:
total=(m1+m2+m3+m4)
per=total/4
print("Result : Fail")
else:
if(per>=90):
print("Grade : A+")
print("Grade : A")
print("Grade : B+")
print("Grade : B")
print("Grade : C")
print("Percentage : ",per)
a="1234"
b=int(a[0])+int(a[1])+int(a[2])+int(a[3])
for i in range(1,7):
for j in range(0,i):
print(i,end=" ")
print()
#Program No. 7
for i in range(1,7):
for j in range(0,i):
print(i,end=" ")
print()
#Program No. 8
a=1
for i in range(1,7):
a=a+1
print()
#Prohram No. 9
a=1
for i in range(1,7):
for j in range(1,i):
if(a%2==0):
else:
print("1",end=" ")
a=a+1
print()
#Program No. 10
a=['A','B','C','D','E']
for i in range(1,7):
for j in range(0,i-1):
print(a[j],end=" ")
#11
n=5
# number of spaces
k = 2*n - 2
print(end=" ")
k=k-1
# printing stars
print("\r")
flg=0
for i in range(1,a):
for j in range(2,i):
if(i%j==0):
flg=0
break
else:
flg=1
if(flg==1):
else:
print("Prime")
#16.Write a program to input a number and display sum of all the digits
of number.
res=0
for i in range(0,len(a)):
res=(res+int(a[i]))
b=a
res=0
while(b!=0):
re=b%10
res=res + (re*re*re)
b=b//10
else:
n=int(input("Enter number:"))
temp=n
rev=0
while(n>0):
d=n%10
rev=rev*10+d
n=n//10
if(temp==rev):
print("number is a palindrome!")
else:
w = ""
for i in x:
w=i+w
if (x==w):
print("String is Palindrome")
if(x!=w):
a=[]
total=0
for i in range(0,10):
total=total+a[i]
a.sort()
print("Average is : "+str(total//10))
a=[]
for i in range(1,11):
b=0
for i in a:
if(str(5) in i):
b=b+int(i)
def fun(a1,a2):
print(fun("sanket","Jethava"))
ans=1
def rec(a):
if(a!=0):
for i in range(1,a+1):
global ans
ans=ans*i
a=a-1
rec(a)
return ans
def f():
def f2():
global x
x=x+10
nonlocal x
x=x+1
f2()
x=10
x=x+5
f1()
x=20
print("Global X : ",x)
f()
print("Global X : ",x)
def filter1():
print("Start of filter()\n","-"*50)
print(list1)
print("End of filter()\n","-"*50)
print("-"*50)
def map1():
print("Start of map()\n","-"*50)
print(list1)
print("End of map()")
import functools
def reduce1():
filter1()
map1()
reduce1()
import os
print("-"*100)
print()
print(str("*"*30),"USE OF SPLIT()",str("*"*30) )
print()
print(a.split())
print("-"*100)
print()
print()
print("-"*100)
print()
print(str("*"*30),"USE OF RSPLIT()",str("*"*30) )
print()
print(a.rsplit())
print("-"*100)
print()
print()
print(a.rsplit())
print("-"*100)
print()
print(str("*"*30),"USE OF SPLITLINES()",str("*"*30) )
print()
print(a.splitlines())
print("-"*100)
print(str("^"*30),"USE OF RANDRANGE",str("^"*30))
print("random.randrange() : ",random.randrange(12,100,5))
print()
print(str("^"*30),"USE OF RANDOM",str("^"*30))
print("random.random() : ",random.random())
print(str("^"*30),"USE OF CHOICE",str("^"*30))
l1=[12,32,4,65,76,43,74]
print("random.choice() : ",random.choice(l1))
random.shuffle(l1)
try:
ans=10/0
print("Error : ",ve)
print("Error : ",zd)
except:
else:
finally:
f=open(r"E:\FoCA\MCA\SEM 3\PYTHON\PROGRAMS\test.txt","r")
for x in f.read():
print(x,end="")
f=open(r"E:\FoCA\MCA\SEM 3\PYTHON\PROGRAMS\test.txt","r")
words=0
lines=0
if(x in '\n'):
lines=lines+1
words=words+1
words=words+1
print(x,end="")
f=open(r"E:\FoCA\MCA\SEM 3\PYTHON\PROGRAMS\test.txt","r")
found=0
l1=[]
s=""
for x in f.read():
s=s+x
s=""
found=found+1
print(found)
2. Search Students
5. Delete Student
7. Exit
'''
import os
import pickle
def AddStudent():
d = {}
f = open("student.txt", "ab")
pickle.dump(d, f)
f.close()
def SearchStudent():
f = open("student.txt", "rb")
try:
while(True):
d = pickle.load(f)
if(d["rollno"]==srollno):
found = True
except:
f.close()
if(found==False):
def ListStudents():
f = open("student.txt", "rb")
print("-"*len(x))
print("-"*len(x))
while(True):
d = pickle.load(f)
except:
print("-"*len(x))
f.close()
f = open("student.txt", "rb")
ft = open("temp.txt", "wb")
found = False
try:
while(True):
d = pickle.load(f)
if(d["rollno"]==srollno):
found = True
pickle.dump(d, ft)
else:
except:
f.close()
ft.close()
os.remove("student.txt")
os.rename("temp.txt", "student.txt")
if(found==False):
else:
def DeleteStudent():
f = open("student.txt", "rb")
ft = open("temp.txt", "wb")
try:
while(True):
d = pickle.load(f)
if(d["rollno"]==srollno):
if(dch in "Nn"):
pickle.dump(d, ft)
else:
found = True
pickle.dump(d, ft)
except:
f.close()
ft.close()
if(found==False):
else:
os.remove("student.txt")
os.rename("temp.txt", "student.txt")
ch = 1
os.system("cls")
print("-------------------------")
print(" 6. Exit")
if(ch==1):
AddStudent()
elif(ch==2):
SearchStudent()
elif(ch==3):
ListStudents()
elif(ch==4):
UpdateStudent()
elif(ch==5):
DeleteStudent()
print("Bye Bye")
'''
'''
def zip():
f=ZipFile("abc.zip","w")
f.write("p21.py")
f.write("p22.py")
f.write("p23.py")
f.close()
def unzip():
f=ZipFile("abc.zip","r")
f.extractall()
f.close()
while(True):
print("3. Exit")
if ch==1:
zip()
elif ch==2:
unzip()
else:
exit()
'''
39.Write a Python Program that creates a simple class with any two
functions
'''
class Ex:
num = 0
self.name = name
self.gender = gender
self.age = age
Ex.num = Ex.num + 1
def Hello():
print("Hello There")
def Display(self):
print("---------------------")
a.Display()
#b.Display()
Ex.Hello()
'''
'''
'''
'''
class Student:
def __init__(self):
def Display(self):
print("---------------------")
a = Student()
#b = Student()
setattr(a,"name","sanket")
#setattr(b,"name","Jethava")
a.Display()
#b.Display()
'''
'''
class Ab():
def __init__(self,a=None,b=None,c=None):
print("paramter - I : ",a)
print("paramter - I : ",a)
print("paramter - II : ",b)
print("paramter - I : ",a)
print("paramter - II : ",b)
b=Ab("Sanket")
c=Ab("Sanket","Jethava")
d=Ab("Writer","Sanket","Jethava")
'''
43.Write a Python Program that creates a class and inherit into another
class (Base Class : Student with rollno, name, gender, age)
'''
class Student:
def __init__(self,rollno,name,gender,age):
self.rollno=rollno
self.name=name
self.gender=gender
self.age=age
self.sets()
print("Name : ",self.name)
print("Gender : ",self.gender)
print("Age : ",self.age)
class Course(Student):
def __init__(self,cname,duration,fee,rollno,name,gender,age):
super().__init__(rollno,name,gender,age)
self.cname=cname
self.duration=duration
self.fee=fee
self.setc()
def setc(self):
print("Duration : ",self.duration)
print("Fee : ",self.fee)
a=Course("MCA","3 YEAR",85000,3058,"SANKET","M",21)
'''
class A:
def __init__(self):
class B(A):
def __init__(self):
super().__init__()
a=B()
'''
45.Write a Python Program that inherits one class into another class
with does FUNCTION OVERRIDING
'''
class A:
class B(A):
def dis(self):
super().dis()
a=B()
a.dis()
'''
'''
import pylab as py
py.plot([1,2,3,4],[10,20,30,40])
py.show()
'''
'''
import pylab as py
py.figure("Student 1 Detail")
py.xlabel("Subjct")
py.ylabel("Obtained Marks")
py.plot([1,2,3,4],[18,20,19,20],color="g",linewidth=10)
py.savefig("first.png")
py.title("Student 1 record")
py.show()
'''
'''
import pylab as py
x = [1,2,3,4]
py.xlabel("Years")
py.ylabel("Experience")
py.title("Experience Summary")
py.show()
'''
'''
import pylab as py
myexplode=[0.1, 0, 0, 0]
py.show()
'''
'''
import sys
sys.__stdout__ = sys.stdout
# df2 = pd.read_csv("e:\\mydata1.csv")
# df2 = pd.DataFrame(mydic)
print(df1)
'''
df1["Name"]
df1[df1.Age>=30]
df1["Name"][df1.Age>=30]
df1[["Name", "Age"]][df1.Gender=="M"]
df1.head()
df1.head(3)
df1.tail()
df1.tail(3)
df1.shape
df1.columns
df1.size
df1.dtypes
df1.describe()
#It will take all numerical columns of data frame and show various
statistical calculations on all those numerical columns
df1["Age"].describe()
df1["Age"].max()
df1["Name"][df1.Age==df1["Age"].max()]
df1.index
df1.set_index("RollNo")
# It will just show rollno index but won't replace original index
df1.set_index("RollNo", inplace=True)
df1.loc[109]
#This will return sorted data as per "Age" column in ascending order
df1.dropna()
# This will drop all the rows which has null values anywhere
df1.fillna("NULL")
# This will display "No Name" for all null names, 0 for all null ages. For
other null columns it will display "NaN" only'''
'''
'''
import pandas as pd
import sys
sys.__stdout__ = sys.stdout
df1 = pd.read_csv("mydata.csv")
class A:
def DisplayA(self):
print("Display A")
class B:
def DisplayB(self):
print("Display B")
class C:
def DisplayC(self):
print("Display C")
class X(A):
def DisplayX(self):
print("Display X")
def DisplayY(self):
print("Display Y")
def DisplayAA(self):
print("Display A")
'''Write a menu driven program for Bank application and also use pickle
to store detail in file
1. Add Account
2. Withdraw Money
3. Deposite Money
5. Exit
'''
import os
import pickle
def acc():
d = {}
f = open("bank.txt", "ab")
pickle.dump(d, f)
f.close()
def withdraw():
f = open("bank.txt", "rb")
try:
d = pickle.load(f)
b=int(d["amount"])
c=b-a
d["amount"]=c
pickle.dump(d,f1)
break
else:
pickle.dump(d,f1)
f.close()
f1.close()
except:
f.close()
f1.close()
f.close()
f1.close()
os.rename("temp.txt", "bank.txt")
def deposite():
f = open("bank.txt", "rb")
try:
while(True):
d = pickle.load(f)
b=int(d["amount"])
c=b+a
d["amount"]=c
pickle.dump(d,f1)
break
else:
pickle.dump(d,f1)
f.close()
f1.close()
f.close()
f1.close()
os.remove("bank.txt")
os.rename("temp.txt", "bank.txt")
def view():
f = open("bank.txt", "rb")
try:
print("-"*len(x))
print("-"*len(x))
while(True):
d = pickle.load(f)
print("-"*len(x))
f.close()
while(1):
print(" 5. Exit")
if ch==1:
acc()
elif ch==2:
withdraw()
elif ch==3:
deposite()
elif ch==4:
view()
else:
exit()
import pylab as pl
import random
class test(Thread):
def test1(self):
for i in range(6):
pl.figure("Test "+str(i))
l1=[10,20,30,40]
pl.plot(l1,l1)
pl.show()
self.test2()
def test2(self):
sleep(1)
def pie1(self):
pass
self.test1()
c=test().start()
l=Lock()
def test():
def test1():
b=0
while(True):
sleep(0.8)
b=b+1
def test2():
l.acquire()
for i in range(10):
l.release()
t1=Thread(target=test2).start()
t2=Thread(target=test1)
t2.daemon=True
t2.start()
t=Thread(target=test).start()
class test():
b=0
def __init__(self):
self.l=Lock()
def test1(self):
self.l.acquire()
for i in range(10):
sleep(1)
def test2(self):
while(True):
#for i in range(15):
sleep(0.9)
test.b=test.b+1
t=test()
t1=Thread(target=t.test1)
t2=Thread(target=t.test1)
t3=Thread(target=t.test2)
t3.daemon=True
t1.start()
t3.start()
t2.start()
'''Write a menu driven program for Bank application and also use pickle
to store detail in file
1. Add Account
3. Deposite Money
5. Exit
'''
import os
import pickle
def acc():
d = {}
f = open("bank.txt", "ab+")
pickle.dump(d,f)
f.close()
def withdraw():
f = open("bank.txt", "rb+")
try:
while(True):
d = pickle.load(f)
if(d["accountno"]==i1):
b=int(d["amount"])
c=b-a
d["amount"]=c
pickle.dump(d,f1)
else:
pickle.dump(d,f1)
except:
f.close()
f1.close()
f.close()
f1.close()
os.remove("bank.txt")
os.rename("temp.txt", "bank.txt")
def deposite():
f = open("bank.txt", "rb+")
try:
d = pickle.load(f)
if(d["accountno"]==i1):
b=int(d["amount"])
c=b+a
d["amount"]=c
pickle.dump(d,f1)
else:
pickle.dump(d,f1)
except:
f.close()
f1.close()
f.close()
f1.close()
os.remove("bank.txt")
os.rename("temp.txt", "bank.txt")
f = open("bank.txt", "rb+")
try:
print("-"*len(x))
print("-"*len(x))
while(True):
d = pickle.load(f)
except:
print("-"*len(x))
f.close()
while(1):
print(" 5. Exit")
if ch==1:
acc()
elif ch==2:
withdraw()
elif ch==3:
deposite()
elif ch==4:
view()
else:
exit()
#A program where two threads are acting on the same method to allot
a berth for the passenger.
class Gadi():
def __init__(self,total):
self.l=Lock()
def booking(self,require):
self.l.acquire()
sleep(3)
if(self.total>=require):
nm=current_thread().getName()
self.total=self.total-require
else:
self.l.release()
g=Gadi(50)
t2=Thread(target=g.booking,args=(s2,))
t1.setName(nm1)
t2.setName(nm2)
t1.start()
t2.start()
# This program will input url from user and read the source code of that
particular url
# simply use above method and store it as file object and then display
using "read()" method
import urllib.request
import re
# You can input url using input() but remember enter proper url else it
will not read
myurl = "https://www.google.co.in/"
try:
file = urllib.request.urlopen(myurl)
data = file.read()
f=open("test2.txt","w")
f.write(str(data))
f.close()
f=open("test2.txt","r")
ans=[]
for i in f.readlines():
ans=re.findall("<\w+>",i)
#ans=re.findall("html",str(data))
print(ans)
except:
import socket
addr = socket.gethostbyname(host)
except socket.gaierror:
# This program will input the URL from user and parse it
# After parsing we can view different parts of URL which we can get
using "urlparse()" function of "urllib.parse" module
# Part-4 : contains the file which we have given in url. Part-4 can also
contain some query string if we have given
import urllib.parse
url =
"http://www.marwadieducation.edu.in:991/MCA/mylessons.html?nam
e=Nilesh"
ans_url = urllib.parse.urlparse(url)
print("-"*50)
print("-"*50)
# This program will input url from user and read the source code of that
particular url
# simply use above method and store it as file object and then display
using "read()" method
import urllib.request
# You can input url using input() but remember enter proper url else it
will not read
try:
file = urllib.request.urlopen(myurl)
data = file.read()
print(data.decode())
fnew.write(data)
fnew.close()
except:
import urllib.request
# You can input url using input() but remember enter proper url else it
will not download
myurl = "https://www.python.org/static/community_logos/python-
logo.png"
try:
print(myurl)
print("Image Downloaded....")
print(download)
except:
import socket
host = "localhost"
port = 5555
# if we give only following line, will also have same effect because
defualt are IPv4 and TCP
# s = socket.socket()
# bind() method of socket object will connect particular port and host
with "s" object. For TCPServer, we use bind() method on server side.
s.bind((host, port))
s.listen(1)
# accpet() method will put method in accept mode. That means now
this program will run infinitely till it receives any request from client.
The moment it receives any request, it will move forward to the next
line of the program after "accept()" method.
# accept() method will return two values. first object of client and
second address of client
# using send() method we can send messages but must sent in BINARY
format
c.send(b"Bye... Bye....")
c.close()
# if you use "bind()" method, you use "send()" method to send data to
client
# if you use "connect()" method, you use "recv()" method to receive the
data from server
host = "localhost"
port = 5555
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# connect() method also uses host and port to connect with server
s.connect((host, port))
msg = s.recv(10)
msg = s.recv(10)
s.close()
# UDP object has a method called "sendto()" which has two parts as
follows
# Part-1 : This is your message which you want to send (Must send
binary message only)
import socket
import time
port = 6666
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
time.sleep(5)
print("Done....")
s.close()
# UDP client object has a method called "recvfrom()" which has two
parts as follows
import socket
import time
host = "localhost"
port = 6666
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((host, port))
try:
s.settimeout(5)
while(msg):
except:
s.close()
# This is a FILE Server program which will create a TCP socket and send
the data to client
# THis program accepts name of file name with path from client once
connected
import socket
host = "localhost"
port = 5555
s = socket.socket()
s.listen(1)
c, addr = s.accept()
# This recv() method will receive name of the file from client
fname = c.recv(1024)
fname = str(fname.decode())
try:
data = f.read()
c.send(data)
f.close()
except FileNotFoundError:
except:
c.close()
# Step-1 This program will first get connected with File Server
# Step-4 Server will receive file name and send the content
import socket
host = "localhost"
port = 5555
s = socket.socket()
s.connect((host, port))
fname = input("Enter File name with Path to Read from File Server : ")
# Send the name of file name in binary format using "encode()" method
s.send(fname.encode())
content = s.recv(1024)
print("--------------------------------")
print(content.decode())
content = s.recv(1024)
print("--------------------------------")
s.close()
# The only thing is, this program will do "send()" and "recv()" method
both
# It will continue the loop until the data is received from client
import socket
host = "localhost"
port = 6666
s = socket.socket()
s.listen(1)
c, addr = s.accept()
while True:
data = c.recv(1024)
if not data:
break
c.close()
s.close()
# The only thing is, this program will do "send()" and "recv()" method
both
# It will continue the loop until the data is received from client
import socket
host = "localhost"
port = 6666
s = socket.socket()
s.connect((host, port))
s.send(str.encode())
data = s.recv(1024)
s.close()
# THis program will allow you to send mail to any SMTP Mail
# For SMTP mail, we shall create object of "MIMEText" class with Body
Text
import smtplib
msg = MIMEText(body)
fromaddr = "[email protected]"
toaddr = "[email protected]"
msg["From"] = fromaddr
msg["To"] = toaddr
server.starttls()
server.login(fromaddr, "XXX")
server.send_message(msg)
server.quit()
print(mylist)
print(ans)
print(ans1)
import functools
mylist1 = [1,2,3,4,5]
print(mylist)
print(ans)
import pylab as pl
ages =
[10,34,1,3,4,90,243,23,34,23,56,454,676,44,44,33,56,75,43,45,77,44,1
1,45,75,354,334,73,44,34,55,6,46,77,55,33,23,6,87,5,3,3,23,34,34,22,4
4,55,76, 65]
pl.show()
import mysql.connector as db
import pandas as pd
import pylab as pl
import re
con=db.connect(host="localhost",database="test",user="root",passw
ord="")
cur=con.cursor()
def all():
al.call_all()
f=open("regex.txt","w")
for i in range(n):
f.write(s)
f.close()
f=open("regex.txt","r")
for i in f.readlines():
ans=re.findall(pattern,i)
if(ans):
print("Pattern Match")
print(ans)
break
else:
def insert_record():
cur.execute(s)
con.commit()
print_record()
def update_record():
print_record()
id=int(input("Enter id : "))
cur.execute(s)
con.commit()
def delete_record():
print_record()
id=int(input("Enter id : "))
cur.execute(s)
con.commit()
print_record()
def print_record():
a=cur.fetchall()
for i in a:
def create_csv():
s="id,name,price\n"
f.write(s)
for i in a:
s=str(i[0])+","+i[1]+","+str(i[2])+"\n"
f.write(s)
def create_excel():
s="id\tname\tprice\n"
f1.write(s)
for i in a:
s=str(i[0])+"\t"+i[1]+"\t"+str(i[2])+"\n"
f1.write(s)
df=pd.read_csv("test.csv")
def show_dataframe():
print(df)
id=list(df["id"])
name=list(df["name"])
price=list(df["price"])
myexplode=[]
mx=max(price)
for i in range(len(price)):
if (price[i]==mx):
myexplode.append(0.1)
else:
myexplode.append(0)
pl.pie(price,labels=name,explode=myexplode)
pl.legend()
pl.show()
while(True):
print("--"*30)
print("5. Fetch record from Database and write CSV and print
record using DATAFRAME and draw PIE Graph")
print("9. Enter string from user and write it in file and also take
pattern from user and match pattern after fetching record from file
and display result.")
print("0. Exit")
if(choice==1):
print_record()
elif(choice==2):
create_csv()
elif(choice==3):
create_excel()
elif(choice==4):
show_dataframe()
show_graph()
elif(choice==6):
insert_record()
elif(choice==7):
update_record()
elif(choice==8):
delete_record()
elif(choice==9):
regex()
elif(choice==10):
all()
break
all_datatype.py
def call_all():
while(1):
print('1. List')
print('2. Tuple')
print('3. Dictionary')
print('0. Stop')
if ch=='1':
#...............................START LIST...........................
l1=[1,2]
while(1):
print('1. Append')
print('2. Count')
print('3. Insert')
print('4. Extend')
print('5. Remove')
print('6. Index')
print('7. Pop')
print('8. Sort')
print('9. Reverse')
print('10. Dislay')
print('0. Stop')
if ch=='1':
for i in range(1,n+1):
print(l1)
elif ch=='2':
print('Total no of occurance is
:',l1.count(c))
elif ch=='3':
l1.insert(i,e)
elif ch=='4':
l2=[]
for i in range(1,m+1):
print('List 1 is : ',l1)
l2.extend(l1)
elif ch=='5':
print(l1)
l1.remove(a)
elif ch=='6':
print(l1)
l1.index(b)
print('Index is :',l1.index(b))
elif ch=='7':
print(l1)
print(l1)
elif ch=='8':
print(l1)
l1.sort()
elif ch=='9':
print(l1)
l1.reverse()
elif ch=='10':
print(l1)
elif ch=='0':
break;
print('=================================================
====================================================')
#...............................END LIST...........................
elif ch=='2':
#-------------------------------START TUPLE-------------------------------------
-------
while(1):
print('0. Stop')
if ch=='1':
elif ch=='2':
del t1
elif ch=='3':
if b in t1:
print(b,' is in tuple')
print('Not in tuple')
elif ch=='4':
print(t1)
elif ch=='5':
print(t1)
elif ch=='6':
print('Tuple is : ',t1)
elif ch=='0':
break;
print('=================================================
====================================================')
#-------------------------------END TUPLE----------------------------------------
----
elif ch=='3':
#++++++++++++++++++++++++++++++++++++++++++DICTIONARY
START++++++++++++++++++++++++++++
while(1):
print('0. Stop')
if ch=='1':
for i in range(1,n+1):
d[k]=v
elif ch=='2':
print(d)
elif ch=='3':
del d[r]
elif ch=='4':
del d
elif ch=='5':
d.clear()
elif ch=='0':
break;
print('====++++@@@@++++@@@@========++++@@@@+++
+@@@@========++++@@@@++++@@@@========++++@@@@
++++@@@@========++++@@@@++++@@@@====')
#++++++++++++++++++++++++++++++++++++++++++DICTIONARY
END++++++++++++++++++++++++++++
elif ch=='4':
#==================================STRING
END==================================
while(1):
print('4. Split')
print('0. Stop')
if ch=='1':
print('String is : '+st)
elif ch=='2':
elif ch=='3':
print(type(st))
elif ch=='4':
print(st.split())
elif ch=='0':
break;
print('=================================================
====================================================')
#==================================STRING
END==================================
break;
print('====++++@@@@'*10)
import pandas as pd
import mysql.connector as db
d=pd.read_csv("test.csv")
name=list(d["name"])
id=list(d["id"])
price=list(d["price"])
con=db.connect(host="localhost",database="test",user="root",passw
ord="")
cur=con.cursor()
for i in range(len(d["id"])):
cur.execute(s)
con.commit()
con.close()