text to DB
Praveen
praveen.python.plone at gmail.com
Mon Aug 16 06:17:06 EDT 2010
On Aug 14, 11:15 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Fri, 13 Aug 2010 09:46:34 -0700 (PDT), Praveen
> <praveen.python.pl... at gmail.com> declaimed the following in
> gmane.comp.python.general:
>
> > I have a text file in this format
> > PRA 1:13 2:20 3:5
> > SRA 1:45 2:75 3:9
> > TRA 1:2 2:65 3:45
>
> > pattern is- Book Chapter:Verses
>
> > now i have my DB schema like this
> > book_id chapter_id versed_id
>
> Off hand, I'd say that's an incomplete schema since there is not
> enough information available to reconstruct the input data...
>
> I'd say there should be a second relation containing
>
> book_id book_name
>
>
>
> > could any one give me suggestion
>
> Is there a possibility that a given book "name" can appear multiple
> times?
>
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr... at ix.netcom.com HTTP://wlfraed.home.netcom.com/
f = open("/Users/Trellisys/Desktop//BibleDB/Booktable.txt","r")
bk=[]
cv = []
j=1
d={}
for line in f:
for l in line.split():
if l.isalnum():
bk.append(j)
j = j+1
else:
cv.append(l.split(":"))
'''for i in l.split(":"):
if i.isalpha():
#print i,j
j = j+1
else:
#print i'''
print bk
print cv
output
[1,2,3] but i am not getting how to map chapterId and versesId with
bookId
Regards,
Praveen
More information about the Python-list
mailing list