0% found this document useful (0 votes)
129 views18 pages

Airline Booking System in Python

This document describes an airline booking system created using Python. The system allows customers to search for flights between two cities on a specified date, select a flight, book and pay for it. It stores customer and flight details in databases. The system aims to simplify the airline reservation process and make booking more convenient for passengers. Python was used to build the graphical user interface and because it is an interpreted, interactive and object-oriented programming language.

Uploaded by

Shiv Makwana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views18 pages

Airline Booking System in Python

This document describes an airline booking system created using Python. The system allows customers to search for flights between two cities on a specified date, select a flight, book and pay for it. It stores customer and flight details in databases. The system aims to simplify the airline reservation process and make booking more convenient for passengers. Python was used to build the graphical user interface and because it is an interpreted, interactive and object-oriented programming language.

Uploaded by

Shiv Makwana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

EasyChair Preprint

№ 4817

Airline Booking System Using Python

Tanniru Sravanthi, Bathini Manideep and Mala Navyasree

EasyChair preprints are intended for rapid


dissemination of research results and are
integrated with the rest of EasyChair.

December 29, 2020


AI
RLI
NEBOOKI
NGSYSTEM USI
NGPYTHON
TANNI
RUSRAVANTHI
,
BHATHI
NIMANI
DEEP,
MALANAVYASREE

MALLAREDDYCOLLEGEOFENGINEERI
NG
ABSTRACT: INTRODUCTI
ON:

Thi spr ojecthel pst obui lda “Airl


ineReservationSy stem”
i
nt er f
acebet weent heai rl
ine projectisanat t
emptt ostimul at
e
compani esandt hepassenger sso thebasi cconcept sofai r
li
ne
thatt heycanbookt icket sf r
om reserv at
ionsystem.Thesy stem
any wher einthewor l
d.Thesy stem enabl esthecustomert odot he
shoul daskf ort het ravel f
r om and thingssuchassear chf orairl
ine
trav el toci t
ies.Forbooki ngt he fl
ightsf ortwotravel ci
ti
esona
cust omer shast osign- uporsi gn- speci fi
eddate,chooseaf li
ght
i
nandent erthepassenger s basedont hedet ai
ls,reservati
on
det ails.Itisasi mpl eai rli
ner ail
way off l
ightandcancel lati
onof
reser v ationsy stem whi chuses reserv at
ion.
TKi ntert obuildupaGUIand
Thesy stem al l
owst heai rl
i
ne
SQLi t
edat abaset ost or ethesi gn-
passengert osear chf orfli
ghts
upi nf or mat i
onofapassenger .The
thatar eav ai
lablebet weent hetwo
travel from andt oci tyshoul dbe
travelcities,namel ythe“ Depart
ure
differentot herwi sei twoul dshow
city
”and“ Arriv
al cit
y ”fora
aner ror .I
tusesdi f
fer entmodul es
particulardepar tureandar riv
al
ofTKni tertobui l
dar eserv ati
on
dates.Thesy stem di splaysallt
he
sy stem usi ngbut t
on, l
abel ,
fl
ight ’
sdet ai
lssuchasf l
ightno,
messagebox, ent ry,framesand
name, priceanddur ati
onof
ti
tle.Whent hepr ogram r uns, i
twill
j
our neyet c.
showaf r
amewhi chasksabout
depar tur eandar ri
val City,andif Aftersearchthesystem di
splay
thecust omerwant st obookhe l
istofav ai
labl
efl
ightsandallows
canpr oceedwi tht hesi gn- i
nand customert ochooseapar t
icular
sign- up. fl
ight.Thenthesystem checksfor
theavailabili
tyofseatsonthe i
nt erpreted,int
eractiv
eandobj ect
-
fl
ight
.Ift heseatsar eavai
l
abl
e orientedscr ipt
inglanguage.
thenthesy stem allowsthe Py thoni sdesignedt obehi ghly
passengert obookaseat . readabl e.ItusesEngl i
shkey words
Otherwisei taskstheuserto frequent lywhereasot her
chooseanot herfl
ight. l
anguagesusepunct uation,andit
hasf ewersy nt
actical
Tobookaf l
i
ghtt hesystem asks
const ructionsthanot her
thecust omert oenterhisdet ai
ls
l
anguages.
suchasname, address,cit
y,state,
creditcardnumberandcont act
number .Theni tcheckst hevali
dity
 PythonisInter
preted−
ofcar dandbookt hefli
ghtand
Pythonisprocessedat
updat etheairl
inedatabaseand
runti
mebyt heinterpr
eter.
userdat abase.Thesy stem also
Youdonotneedt ocompi l
e
all
owst hecust omert ocancel
yourprogr
am befor e
his/herreservati
on,ifanyproblem
executi
ngit.Thi
si ssimil
ar
occur s.
toPERLandPHP.

 PythonisInteracti
ve −You
 
     
Themai npurposeoft hi
s canactuall
ysi tataPy t
hon
softwarei st oreducethemanual promptandi nteractwit
hthe
error
si nv olv
edi ntheairl
ine i
nterpr
eterdirectl
ytowr i
te
reservationpr ocessandmakei t yourprogr
ams.
conveni entfort hecustomer st o
 PythonisObject-Ori
ented−
bookt hef l
i
ght saswhent hey
Pythonsuppor t
sObject-
requir
esucht hattheycanut il
ize
Ori
entedstyleortechnique
thi
ssof twar et omaker eser v
ations,
ofprogrammi ngthat
modi f
yr eser vati
onsorcancel a
encapsulat
escodewi thin
parti
cularr eservati
on.
object
s.
PYTHON:
 PythonisaBeginner
's
Py
thoni
sahi
gh-
lev
el, Language−Pythonisagr
eat
l
anguageforthebegi nner- Py
thon'
sfeat
uresi
ncl
ude:
l
evelpr
ogrammer sand
 Easy-
to-learn −Py t
honhas
suppor
tsthedev elopmentof
fewkey words, si
mple
awiderangeofappl icat
ions
str
ucture,andacl earl
y
fr
om si
mpl etextprocessing
defi
nedsy ntax.Thisall
ows
toWWW br owserst ogames.
thestudenttopi ckupthe
l
anguagequi ckly
.

Hi
stor
yofPy
thon:  Easy-
to-
read 
−Py t
honcode
i
smor eclear
lydef
inedand
Pythonwasdev el
opedbyGui do
vi
sibl
etotheeyes.
vanRossum i nthelat
eei ght
ies
andear l
ynineti
esattheNat ional Easy-t
o-mai
ntai
n −Pyt
hon's
ResearchInsti
tutefor sourcecodei
sfairl
yeasy
-to-
Mat hemati
csandComput er maintai
n.
Sci
encei ntheNet her
lands.
 Abr oadstandardli
brary 

Pythonisderi
vedf r
om manyot her Py t
hon'sbulkoftheli
brar
yis
l
anguages, i
ncl
udingABC, Modula- veryportabl
eandcr oss-
3,C,C++,Algol
-68,SmallTal
k,and platfor
m compatibl
eon
Unixshell
andot herscr
ipti
ng UNI X,Windows,and
l
anguages. Maci nt
osh.
Pythoni
scopy r
ight
ed.Li
kePer
l, Int
eract
iveMode −Py t
hon
Pythonsourcecodeisnow hassupportforan
avail
abl
eundertheGNUGeneral i
nteract
ivemodewhi ch
Publi
cLicense(GPL). all
owsinter
acti
vetesti
ng
Pythonisnowmai ntai
nedbya anddebuggingofsnippet
s
coredevelopmentt eam atthe ofcode.
i
nstit
ute,alt
houghGui dovan  Portabl
e −Py t
honcanr un
Rossum stil
lhol
dsav i
talrol
ein onawi dev ari
etyof
di
recti
ngi t
sprogress. hardwareplatformsandhas
Py
thonFeat
ures: thesamei nterfaceonal
l
pl
atf
orms. st
ructur
edpr
ogr
amming
methodsaswel
lasOOP.
 Extendabl e −Youcanadd
l
ow- l
ev elmodul estothe I
tcanbeusedasascr i
pti
ng
Pythoni nterpreter.These l
anguageorcanbecompi led
modul esenabl e t
oby t
e-codef
orbuil
ding
programmer stoaddt oor l
argeappli
cat
ions.
customi zet heirtoolstobe
Itpr
ovi
desveryhi
gh-l
evel
mor eef f
icient.
dynamicdat
atypesand
 Databases 
−Py thon suppor
tsdynamicty
pe
provi
desinter
facestoal
l checki
ng.
majorcommer cial
I
tsuppor
tsautomati
c
databases.
gar
bagecol
lecti
on.
 GUIPr ogr
ammi ng −Py t
hon
I
tcanbeeasil
yint
egr
ated
supportsGUIappl i
cati
ons
wi
thC,C++,COM,Acti
veX,
thatcanbecr eatedand
CORBA,andJava.
portedtomanysy stem cal
l
s,
l
ibrari
esandwi ndows
systems,suchasWi ndows
Py t
honisavailableonawi de
MFC, Macintosh,andt heX
variet
yofplatformsincluding
Windowsy stem ofUni x.
LinuxandMacOSX.Let '
s
 Scalabl
e −Pythonprov
idesa understandhowt osetupour
bett
erstruct
ureandsupport Py t
honenv i
ronment .
forl
argeprogramsthanshel
l
LocalEnv
ironmentSet
up:
scri
pti
ng.
Openat er
minal
windowandt ype
Apar tfr
om theabove-
ment i
oned
"
python"tofi
ndouti
fitisal
ready
features,Py
thonhasabi gli
stof
i
nstal
ledandwhichversi
onis
goodf eatur
es,fewareli
sted
i
nstal
led.
below−
 Uni
x(Sol
ari
s,Li
nux,
FreeBSD,
I
tsuppor
tsf
unct
ional
and
AI
X,HP/UX,SunOS,I
RIX,et
c.)
 Wi
n9x/
NT/
2000 YoucandownloadPy t
hon
documentat
ion
 Maci
ntosh(
Int
el,
PPC,
68K)
from 
htt
ps:/
/www.python.or g/doc
 OS/
2 /.Thedocumentat
ionisav ailabl
e
i
nHTML, PDF,andPost Script
 DOS(
mul
ti
plev
ersi
ons) format
s.
 Pal
mOS

 Noki
amobi
l
ephones

 Wi
ndowsCE

 Acor
n/RI
SCOS I
nst
all
ingPy
thon:
 BeOS Pythondistri
buti
onisavai
lablef
or
awi devari
etyofplat
for
ms.You
 Ami
ga
needt odownloadonlythebinar
y
 VMS/
OpenVMS codeappl i
cablefory
ourplatf
orm
andi nst
all
Py t
hon.
 QNX
Ift
hebi narycodef oryourpl atform
 VxWor
ks
i
snotav ai
labl
e, y
ouneedaC
 Psi
on compilertocompi lethesour ce
codemanual l
y.Compi lingthe
 Pyt
honhasalsobeenport
ed sourcecodeof fersmor efl
exi bi
li
ty
tot
heJavaand.NETvir
tual i
nt er
msofchoi ceoff eaturest hat
machi
nes yourequi r
einy ourinstall
ati
on.
Get
ti
ngPy
thon: Hereisaqui
ckov
erv
iewof
Themostup- to-dat
eandcur rent i
nstall
i
ngPyt
hononvar
ious
sourcecode,binari
es, pl
atforms
documentati
on, news,etc.
,i
s Wi
ndowsI
nst
all
ati
on:
avail
abl
eontheof f
ici
alwebsiteof
Python 
htt
ps://www. pyt
hon.org/ Her
earethest
epstoi
nst
all
Pyt
hononWindowsmachi
ne.
OpenaWebbr owserandgo envir
onmentv ariable,whichi sa
to 
htt
ps:
//www.py
thon.or
g/downl
o namedst r
ingmai ntai
nedbyt he
ads/. operatingsystem.Thi svariable
containsinfor
mat ionavailableto
Fol
l
owt heli
nkfort
heWi ndows
thecommandshel landot her
i
nstal
l
er py
thon-
XYZ.msi
 fi
lewher
e
programs.
XYZistheversi
onyouneedto
i
nstal
l
. The 
path 
vari
abl
eisnamedas
PATHinUnixorPathinWindows
Tousethisinst
al l
er pyt
hon-
(Uni
xiscasesensi
ti
ve;Wi
ndowsis
XYZ.
msi,theWi ndowssy stem
not)
.
mustsupportMi crosoftInstal
ler
2.
0.Savetheinst al
lerfi
letoy our I
nMacOS, theinstallerhandles
l
ocalmachineandt henruni tto thepathdetail
s.Toi nvoket he
fi
ndoutifyourmachi nesuppor t
s Pythonint
erpreterfrom any
MSI. parti
cul
ardirectory
,y oumustadd
thePythondirectorytoy ourpath.
Runthedownl oadedfil
e.This
bri
ngsupt hePythoninstal
lwizard, Set
ti
ngpat
hatWi
ndows:
whichisreal
lyeasytouse.Just
Toaddt hePy
thondi
rectoryt
othe
acceptthedefaul
tsetti
ngs,wait
pathforapar
ti
cul
arsessioni
n
unti
ltheinst
alli
sfini
shed,andy ou
Windows−
aredone.
Att
hecommandpr
ompt 
−type
pat
h%pat
h%;
C:\
Pyt
honandpress
Set
ti
ngupPATH: Ent
er.

Progr amsandot herexecutabl


e Note 
−C:
\Pyt
honist
hepat
hoft
he
fi
lescanbei nmanydi rect
ori
es,so Pyt
hondi
rect
ory
.
oper ati
ngsy stemspr ovidea
searchpat ht hatli
ststhe
directori
est hattheOSsear ches DJANGO:
forexecut ables.
Asyoual
readyknow,
Djangoi
sa
Thepat
hisst
oredi
nan Pyt
honwebf r
amework.Andl
i
ke
mostmoder nframewor k,Django TheModel -
View-Templ ate(MVT)
supportstheMVCpat tern.Fir
st i
ssl i
ghtlydif
ferentf rom MVC.I n
l
et'sseewhati stheModel -
View- factthemai ndifferencebet ween
Control
ler(MVC)pat tern,andthen thetwopat ternsist hatDj ango
wewi ll
lookatDj ango’sspecifi
cit
y i
tselftakescar eoft heCont r
oll
er
fortheModel -
View-Templ ate part(SoftwareCodet hatcont rols
(MVT)pat ter
n. theinteract
ionsbet weent he
Model andVi ew), l
eav inguswi th
MVCPat
ter
n:
thetempl at
e.Thet empl ateisa
Whent al
kingabout HTMLf i
lemi xedwi thDj ango
appli
cat
ionsthatprovi
desUI( web Templ ateLanguage( DTL) .
ordesktop),
weusuallytalkabout
Thefol
l
owingdiagram i
l
lust
rates
MVCar chit
ectur
e.Andast he
howeachofthecomponent sof
namesuggest s,
MVCpat t
ernis
theMVTpatter
ninter
actswith
basedont hr
eecomponent s:
eachot
hertoserveauserrequest
Model,View,andControl
ler.

DJANGOMVC-MVTPat
ter
n:

Thedevel
operpr
ovi
destheModel
, j
ustmapsi
ttoaURLandDjango
thev
iewandthetempl
atethen doest
hemagict
oser
veitt
ot he
user
. f
ormat
ti
ngof t
her
esponse
t
o t
emplat
es.
Djangodev elopmentenv i
ronment
consistsofi nstal
lingandsetti
ng  Model s:
 Modelsar ePy t
hon
upPy thon,Dj ango, andaDatabase objectsthat 
define 
the
System.Si nceDj angodealswith structur
eofan  appli
cati
on's
webappl ication,i
t'sworth data,and
ment i
oningt haty ouwouldneeda provide 
mechani smst o
webser verset upaswel l. manage( add,modify,delet
e)
andquer yrecordsinthe
 URLs:  Whi l
eitispossi bleto
database. 
processr equestsf r
om ev ery
singleURLv iaasi ngle  Templ ates: 
A templ at
eisa
funct i
on, i
tismuchmor e textfil
edef i
ningt he
mai ntainabletowr itea structureorlayoutofaf ile
separ atev i
ewf unct i
ont o (suchasanHTMLpage) ,
handl eeachr esour ce.AURL withpl acehol
der susedt o
mapperi susedt oredirect representactual content.
HTTPr equest stot he A view candy nami cal
ly
appr opriateview basedon createanHTMLpageusi ng
ther equestURL.TheURL anHTMLt empl at e,
mappercanal somat ch populat i
ngitwi t
hdat afrom
particularpatternsofst ri
ngs a model .Atempl atecanbe
ordi git
st hatappeari naURL usedt odef i
net hest r
ucture
andpasst hesetoav iew ofanyt ypeoffile; i
tdoesn't
funct i
onasdat a. hav etobeHTML!

 View:  
Av i
ewi sa request
handl erf
unction,which
I
nst
all
ingDj
ango:
receivesHTTPr equestsand
returnsHTTPr esponses. I
nstal
li
ngDj angoisvery
Viewsaccesst hedat a easy,butthestepsrequir
edforit
s
neededt osatisfyrequests i
nstall
ati
ondependsony our
via models,anddel egatet
he operati
ngsystem.Si ncePyt
honis
aplatf
orm-i
ndependentlanguage, based 
command- l
inei
nterf
ace,
Djangohasonepackaget hat suchas 
MS- DOS,or
workseverywher
eregardlessof the 
shel

of 
Unix-
li
ke 
operat
ing
youroperat
ingsyst
em. syst
ems.

Youcandownl oadthel
atest TheGUIwasf i
rstdeveloped
versionofDj
angofrom t
he at 
XeroxPARC  by 
Alan
l
ink htt
p:/
/www.dj
angoproj
ect.
co Kay, 
Dougl
asEngel bart,anda
m/ download groupofotherresearchersin 
1981.
Later

Appl
e int
roducedt he Li
sa
computer 
withaGUIonJanuar y
19, 
1983.

Howdoy
oupr
onounceGUI

GUI[
graphi
caluseri
nter
face]
: GUIispronouncedby
sayingeachlet
ter(G-U-
I)
.It
A GUI  
(graphical userinterface)is
somet i
mesisalsopronouncedas
asy stem ofint eracti
vev isual
"gooey.
"
component sf or
comput er 
softwar e.AGUIdi splay
s
objectst hatconv eyinformat ion,
HowdoesaGUIwor
k?
andr epresentact i
onst hatcanbe
takenbyt heuser .Theobj ect
s AGUI
changecol or
, size,orvisibil
it
y uses windows, 
icons,
whent heuseri nteractswi ththem. and menus tocarryout
commands, suchasopeni ng,
GUIobjectsincl
ude i
cons, cursors,
deleti
ng,andmov i
ngfil
es.
and but
tons.Thesegr aphical
AlthoughaGUIoper at
ingsy stem
el
ement saresomet i
mes
i
spr imari
lynavigatedusing
enhancedwi thsounds,orv i
sual
a mouse, akeyboardcanal sobe
eff
ectsli
ke t
ransparency and drop
usedv i
a keyboardshortcuts or
shadows.
the ar
rowkey s.
AGUIisconsider
edtobe
Asanexampl
e,i
fyouwant
edt
o
mor
e user
-fr
iendl
y t
hanatext
-
opena progr am onaGUIsy st
em,
youwoul dmov ethe mouse
pointer
 t
ot hepr ogram'
sicon
and double-cli
ck i
t. Ar
eal
loper
ati
ngsy
stemsGUI
?

No.Earl
y
commandl i
neoper at
ingsystems
Whatar
ethebenef
it
sofGUI
?
l
ike MS-DOS andev ensome
Unl
ikea  command- versi
onsof  
Linux 
todayhav eno
l
ineoperatingsy stem  or CUI, GUIinterf
ace.
l
ike 
Unix or MS-DOS, GUIoper ati
ng
Whatareexampl
esofaGUI
syst
emsar eeasi ertol earnand
i
nter
face?
usebecausecommandsdonot
needtobememor ized. 1.GNOME
Additi
onally,usersdonotneedt o
2.KDE
knowany  programmi ngl anguages.
Becauseoft hei
reaseofuseand 3.AnyMi crosof
tprogr
am,
moremoder nappear ance, GUI i
ncluding Word,
 
Excel
,
operati
ngsy stemshav ecomet o and Outl
ook.
dominatet oday'smar ket.
4.Int
ernetbrowsers,such
WhatareexamplesofaGUI as 
InternetExpl
orer,
 Chr
ome,
oper
ati
ngsystem? and Fi
refox.

Howdoest
heuseri
nter
actwi
tha
GUI
?
 Mi
crosof
tWi
ndows

 Appl
e Sy
stem 7 
and 
macOS
A point
ingdev i
ce,suchas
 Chr
omeOS
the mouse, i
susedt ointeractwi th
 Linux v
ari
ants nearlyall
aspect softheGUI .Mor e
l
ike Ubunt
u usi
ngaGUI moder n(andmobi l
e)devicesal so
i
nt er
face. util
i
zea touchscr een.Howev er
, as
statedinprevioussections,itis
al
sopossi
bletonavi
gat
eaGUI giv
esPyt
honscripts
usi
nga 
keyboard. seaml
essaccesstoJav a
cl
assl
ibr
ari
esont helocal
DoesaGUIr
equi
reamouse?
machi
ne 
htt
p://
www. jyt
hon.
No.Nearlyal
lGUIi
nter
faces, org
i
ncludingMicrosof
tWindows,
Therearemanyotheri
nter
faces
haveoptionsfornavi
gat
ingt
he
avai
labl
e,whi
chyoucanf i
ndthem
i
nterf
acewi t
hakey boar
donly.
onthenet.

Tki
nterPr
ogr
ammi
ng:

Tkinteri
st hestandard
GUIWI
THTKI
NTER: GUIl i
brar
yforPy thon.Py t
hon
whencombi nedwi thTkinter
providesafastandeasywayt o
Pythonprovi
des createGUIappl i
cations.Tkint
er
vari
ousopti
onsf ordevel
oping providesapower ful obj
ect-
graphi
cal
userinterf
aces(GUI s)
. orientedi
nterfacetot heTkGUI
Mostimportantareli
stedbelow. toolki
t.

Creati
ngaGUIapplicat
ionusi
ng
Tkint
erisaneasytask.Al
lyou
 Tki
nter 
−Tkinteristhe
needtodoisperformthe
Pyt
honinterfacetotheTk
fol
lowingst
eps
GUItool
kitshippedwith
Pyt
hon.Wewoul dlookthi
s  I
mport
opt
ioninthischapter. t
he 
Tki
nter
 modul
e.

 wxPy thon 
−Thisisanopen-  Cr
eatet
heGUIappl
i
cat
ion
sourcePy t
honint
erfacef
or mainwi
ndow.
wxWi ndows ht
tp:
//wxpyt
hon.
 Addoneormoreofthe
org.
above-
menti
onedwidget
sto
 JPyt
hon 
−JPy t
honisa theGUIappl
i
cati
on.
Pyt
honportf
orJavawhich
 Entert
hemai neventloopt
o you’llseeshortenedt oI
DLEor
takeacti
onagainsteach ev enIDE.Thesear eacl assof
eventtr
igger
edbyt heuser
. applicati
onsthathel pyouwr i
te
codemor eeffici
ently
.Whi l
ethere
Exampl
e:
aremany  I
DEs foryoutochoose
#!
/usr
/bi
n/py
thon from, PythonIDLEi sverybare-
bones, whichmakesi tt
heper f
ect
i
mpor
tTki
nter
tool f
orabegi nningprogrammer .
t
op=Tki
nter
.Tk(
)
PythonI DLEcomesi ncludedin
#Codetoaddwi
dget
swi
l
lgo Pythoni nstal
lat
ionsonWi ndows
her
e..
. andMac.I fyou’r
eaLi nuxuser,
theny oushoul dbeabl etofind
t
op.
mai
nloop(
)
anddownl oadPy t
honI DLEusing
Tki
nterWi
dget
s: yourpackagemanager .Once
you’veinstall
edit,y
oucant hen
Tkint
erprovidesvari
ous
usePy thonI DLEasani nt
eract
ive
cont
rols,suchasbut t
ons,label
s
i
nterpreterorasaf il
eedi tor
.
andtextboxesusedi naGUI
appl
icati
on.Thesecont r
olsare AnI
nter
act
iveI
nter
pret
er:
commonl ycall
edwi dget
s.

Thebestpl acet oexper i


mentwi t
h
Py thoncodei sint he interactive
i
nt erpreter,ot
herwi seknownas
a shell.Theshel lisabasi c Read-
Eval -
PrintLoop( REPL) .Itr eadsa
Py thonst atement, evaluatest he
IDLE[I
ntegr
etedDevel
opment
resultoft hatstatement ,andt hen
Learni
ngEnv i
ronment
]:
printsther esul
tont hescr een.
EveryPythoni
nstal
lat
ioncomes Then, itloopsbackt or eadt he
withan 
Integr
atedDev el
opment nextst atement .
andLearningEnvir
onment ,
which
ThePy
thonshel
li
sanexcel
l
ent
placetoexper imentwithsmall Howt
oUset
hePy
thonI
DLEShel
l:
codesni ppets.Youcanaccessit
Theshel li
sthedefaul
tmodeof
throught heterminalorcommand
operationforPyt
honIDLE.When
l
ineappony ourmachine.Youcan
youclickont hei
contoopenthe
simplif
yy ourwor kf
lowwi t
h
program, t
heshelli
sthefi
rstt
hing
Py t
honI DLE,whichwi l
l
thatyousee:
i
mmedi atelystar
taPy thonshel
l
wheny ouopeni t
.

ThisisablankPyt
honint
erpr
eterwindow.Youcanuseitt
ostar
t
i
nteract
ingwithPy
thonimmediatel
y.Youcantesti
toutwi
thashor
tli
neof
code:
Here,youused  pri
nt() 
tooutput Thesqli
te3modul ewaswr i
tt
enby
thestri
ng "
Hello,from IDLE!"
 t
o Gerhar
dHär i
ng.I tprov
idesaSQL
yourscreen.Thisi sthemost i
nterf
acecompl iantwiththeDB-
basicwayt ointeractwithPython API2.0speci
ficationdescri
bed
IDLE.Youtypei ncommandsone by 
PEP249.
atatimeandPy t
honr esponds
Modul
efunct
ionsandconst
ant
s:
withtheresul
tofeachcommand.

sql
i
te3.
ver
sion
SQLI
TE3:
Thev ersi
onnumberoft his
SQLitei saCl ibr ar yt
hatprov ides
modul e,asastr
ing.Thisisnott
he
alight weightdi sk- baseddat abase
ver
sionoft heSQLitel
ibrary
.
thatdoesn’ trequi reasepar at e
serverpr ocessandal l
ows sql
i
te3.
ver
sion_
inf
o
accessi ngt hedat abaseusinga
Theversionnumberofthis
nonst andardv ariantoft heSQL
module,asat upl
eofint
egers.
queryl anguage.Some
Thi
sisnott heversi
onofthe
applicationscanuseSQLi tef or
SQLi
telibrar
y.
i
nternal datast or age.It
’salso
possi bletopr ot ot ypean sql
i
te3.
sql
it
e_v
ersi
on
applicationusi ngSQLi t
eandt hen
Thev
ersi
onnumberoft
herun-
portthecodet oal ar
gerdat abase
ti
meSQLi
tel
ibr
ary
,asastr
ing.
suchasPost gr eSQLorOr acl e.
sql
i
te3.
sql
it
e_v
ersi
on_
inf
o i
nt here, andt hendeci det hat

my t
ype’ isthet ypeoft hecol umn.
Theversi
onnumberoft
herun-
Itwillt
ryt of i
ndanent ryof
ti
meSQLitel
ibr
ary
,asatupl
eof

my t
ype’ intheconv erters
i
nteger
s.
dicti
onar yandt henuset he
conv erterfunct i
onf oundt her et o
returnthev al ue.Thecol umnname
sql
i
te3.
PARSE_
DECLTYPES
foundi n Cursor .description does
Thi
sconst anti
smeantt obeused notincludet het ype,
i.e.i
fy ouuse
wit
ht he detect
_ty
pes 
parameter somet hi ng
ofthe connect(
) f
unct
ion. l
ike '
as "Expir ati
on dat e 
[dat et i
me]"
'
 inyourSQL, thenwewi llpar se
Settingitmakes
outev ery t
hingunt i
lthef irst 
'['
 for
the sqli
te3 modul epar set he
thecol umnnameandst ript he
declaredt ypef oreachcol umni t
preceedi ngspace: thecol umn
returns.Itwillpar seoutt hef i
rst
namewoul dsi mpl ybe“ Expir ati
on
wor doft hedecl aredty pe,i.e.for
date”.
“i
ntegerpr imar ykey ”
,itwi l
l parse
out“ i
nteger ”
,orf or“number (10)”it sqli
te3.connect(dat
abase[

ti
meou
willparseout“ number ”.Thenf or t,
 detect_
types,
 i
solati
on_l
evel
,
 che
thatcolumn, i
twi lll
ooki ntot he ck_
conv ert
ersdi ctionar yanduset he same_ thread,
 f
actory,
 
cached_st
at
conv ert
erf unctionr egister edfor ement s, 
uri
])
thatt y
pet here.
Opensaconnect iontotheSQLi te
sql
i
te3.
PARSE_
COLNAMES databasefi
le 
database.Bydef aul
t
ret
urnsa Connection 
object,
Thi
sconst anti
smeantt obeused
unl
essacust om factor
y isgi
ven.
wit
ht he detect
_ty
pes 
parameter
ofthe connect(
) f
unct
ion. database  i
sa path-l
ike
object  
giv
ingt hepathname
Setti
ngthismakestheSQLite
(absol ut
eorr elat
ivetothecur
rent
i
nterfaceparset
hecolumnname
wor kingdirectory
)ofthedatabase
foreachcolumnitr
eturns.I
twill
fi
let obeopened.Youcan
l
ookf orastri
ngfor
med[ mytype]
use 
":memory:

toopenadatabase Regist
ersacal l
abletoconv ertt
he
connecti
ontoadatabaset
hat custom Pythontype 
type int
oone
resi
desinRAM inst
eadofondisk. ofSQLite’
ssuppor t
edty pes.The
cal
labl
e cal
lable 
acceptsassi ngl
e
Whenadat abaseisaccessedby
parameterthePy t
honv alue,and
multipleconnect i
ons, andoneof
mustreturnav al
ueoft he
thepr ocessesmodi fi
est he
fol
lowingtypes:i
nt,f
loat,stror
database, theSQLi tedatabaseis
bytes.
l
ockedunt i
l t
hattransact i
onis
commi tt
ed. sql
i
te3.
compl
ete_
stat
ement
(sql
)
The ti
meout  
paramet erspecifi
es
Returns True i
fthe
howl ongt heconnect ionshould
stri
ng sql 
containsoneormor e
waitfort helocktogoawayunt i
l
compl eteSQLst atement s
rai
singanexcept i
on.Thedef aul
t
terminatedbysemi colons.Itdoes
forthet i
meoutpar amet eri
s5.0
notv eri
fythattheSQLi s
(fi
veseconds) .
syntacti
callycorrect,onlythat
sql
i
te3.
regi
ster
_conv
ert
er(
typena therearenouncl osedstring
me, 
cal
l
able) l
iteralsandt hestatementi s
terminatedbyasemi colon.
Regi stersacal l
abl et oconv erta
bytestr i
ngf r
om t hedat abasei nt
o SYSTEM REQUI
REMENTS:
acust om Py t
hont ype.The
HARDWAREREQUI
REMENTS:
call
abl ewi l
lbei nvokedf orall
databasev aluest hatar eoft he
type typename.Conf erthe
 Syst
em :
paramet er 
detect_ t
y pes of
Pent
ium Dual
Cor
e.
the connect () 
funct i
onf orhowt he
typedet ectionwor ks.Not e  Har
dDi
sk : 500GB.
that typename  andt henameof
 Monit
or :
thet ypei nyourquer yar emat ched
15’
’LED
i
ncase- insensiti
vemanner .
I
nputDevi
ces :
sql
it
e3.
regi
ster
_adapt
er(
type,
 
cal
l
a
Key
board,
Mouse
bl
e)
 Ram :  Operat
ingsy
stem :
1GB. Windows10.

 Codi
ngLanguage :
Pyt
hon

 Tool :
Django,
PyChar
m

SOFTWAREREQUI
REMENTS:

You might also like