Python:使用.join连接枚举for循环中字符串列表中的项,并接收意外的输出

2024-06-13 09:34:23 发布

您现在位置:Python中文网/ 问答频道 /正文

主要问题:我不明白为什么输出文件没有写1:6和1:23节。我想弄清楚这是为什么,以及如何解决它。你知道吗

我是python新手,不太明白是我的逻辑还是对python中的工作原理的误解导致我误入歧途。我正在使用.join连接枚举for循环中字符串列表中的项,并接收意外的输出。具体来说,我使用python解析一个.txt文件。txt文件包含圣经中单词的数据。我想要新的输出.txt使新的圣经经文与新的诗行一致。问题是,我编写的python脚本完全跳过了测试数据输出的第6节和第23节。我怀疑这与我是如何使用for循环并行连接的,以及我对python的工作原理缺乏了解有关。然而,也可能只是我理解,但犯了一个逻辑错误。这是我的密码。请注意debug语句、我在定义的函数中使用的.join以及这将如何影响我在outer for循环中解析的字符串(“我认为我的错误在哪里,但我可能错了”)。你知道吗

def concatenateNext_string_TF( index, lines_list):
    next_wL_index = index + 1
    if next_wL_index < len(lines_list):
        #ThisIs A variable word_list: tric for splitin a string to a list of words
        problem_var = lines_list[next_wL_index]
        problem_words2 = problem_var.split()
        #Check if this is a vere or a glitch where we start in middle of verse
        if ( (problem_words2[0].isdigit() < 8) and (':' not in problem_words2[0]) ):
            return True

    return False

    #DEBUG: condition_String, real_index
def concatenateNext_string( index, lines_list, condition_String, real_index):
    next_wL_index = index + 1
    if next_wL_index < len(lines_list):
        #ThisIs A variable word_list: tric for splitin a string to a list of words
        problem_var = lines_list[next_wL_index]
        problem_words2 = problem_var.split()

        if ( (problem_words2[0].isdigit() < 8) and (':' not in problem_words2[0]) ):
            print problem_words2[0]+condition_String+"[index:"+real_index+"]" #DEBUG
            #Add a space to the next so that it doesnt join the lastW from this list and firstW from the next
            #Then Join this line and the next
            #Then replace word_list
            lines_list[index+1] = " "+lines_list[index+1]
            lines_list[index:index+2] = [''.join(lines_list[index:index+2])]
            word_list = lines_list[index].split()

    return word_list


#open the file
input_file = open( "/Users/carlosgarzon/Desktop/Projects/LearnHtml/Bereshit/BereshitPython/data_chapter1.txt", "r")

#read file into a list of lines
lines_list = input_file.read().splitlines()

# Close the File stream handler
input_file.close()

# The OPEN function returns a file object
write_file = open("/Users/carlosgarzon/Desktop/Projects/LearnHtml/Bereshit/BereshitPython/out_main_js.txt","w")

# Writing a VARIABLE to file in for loop
for index, var_list in enumerate(lines_list):

    #gltich: A string that does not beging where verse begins i.e genesis 1:7

    #tric for splitin a string to a list of words
    #This will be used if nothing was a glitch
    word_list = var_list.split()

    #get number of words in this verse
    num_word_lists = len(lines_list)

    #If current and next string is a glitch just join current with previous
    if ( (word_list[0].isdigit() < 8) and (':' not in word_list[0]) ) and concatenateNext_string_TF( index, lines_list):
        word_list = concatenateNext_string( index - 1, lines_list, "[cur&nextGlitch]", str(index) )
    #Catches if NEXT string is a glitch 
    if concatenateNext_string_TF( index, lines_list):
        word_list = concatenateNext_string( index, lines_list, "[nextGlitch]", str(index) )
    #If current string is a glitch join it to previous
    elif ( (word_list[0].isdigit() < 8) and (':' not in word_list[0]) ):
        word_list = concatenateNext_string( index - 1, lines_list, "[curGlitch]", str(index) )

    #not including C:V and starting on 0 index
    num_words = len(word_list) - 1

    for index2, word in enumerate(word_list):
        if len(word_list) > 1:
            #Bad Data: References, Page Title, (c) 
            if ( index2 == 0 and word.isdigit() ) or ( word_list[0] == 'The' and word_list[1] == 'Mechanical' ) or ( word_list[1] == 'Jeff' ):
                print "Bad Data"
                break

        #DEBUG: we found a new verse. It's printing the index of the outer for loop not this one
        if ':' in word:
            print word+ "  " + word_list[1]+"("+str(index)+")"+"\n"

        write_file.write(word+"("+str(index2)+")")

    #exit inner for loop        
    write_file.write("NumWordsInVerse("+str(num_words)+")"+"\n")

# Close the FILE object in PYTHON
write_file.close

这是我正在读的文件。注意,有时诗句中间会出现新行。接下来我将展示的输出文件消除了这些问题。问题是,在输出文件中,我注意到数据完全跳过了1:6和1:23节。你知道吗

这是我正在读的文件。我把它浓缩了一点,把那些部分换成。。。。。。你知道吗

    1:1 in~SUMMIT 2363 בְּרֵאשִׁית bê'rey'shit he~did~FATTEN(V) 232 בָּרָּא ba'ra Elohiym POWER~s אֱלֹהִׁים e'lo'him AT 85 אֵת eyt the~SKY 2512~s2 הַשָּמַיִׁם ha'sha'ma'yim and~AT 85 וְּאֵת wê'eyt the~LAND 2331 הָּאָרֶץ ha'a'rets
1:2 and~the~LAND 2331 וְּהָּאָרֶץ wê'ha'a'rets she~did~EXIST(V) 505 הָּיְּתָּה hai'tah CONFUSION 2623 תֹהוּ to'hu and~UNFILLED 106 וָּבֹהוּ wa'vo'hu and~DARKNESS 2439 וְּחֹשֶךְ wê'hho'shekh UPON 1616 עַל al FACE 1815~s פְּנֵי pê'ney DEEP.SEA 522 תְּהוֹם tê'hom and~WIND 2251 וְּרוּחַַ wê'ru'ahh Elohiym POWER~s אֱלֹהִׁים e'lo'him much~FLUTTER(V) 787~ing(fs) מְּרַחֶפֶת mê'ra'hhe'phet UPON 1616 עַל al FACE 1815~s פְּנֵי pê'ney the~WATER 1162~s2 הַמָּיִׁם ha'ma'yim
1:3 and~he~will~SAY(V) 1187 וַיֹאמֶר wai'yo'mer Elohiym POWER~s אֱלֹהִׁים e'lo'him he~will~EXIST(V) 505 יְּהִׁי yê'hi LIGHT 73 אוֹר
or and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi LIGHT 73 אוֹר or
1:4 and~he~will~SEE(V) 2185 וַיַרְּא wai'yar Elohiym POWER~s אֱלֹהִׁים e'lo'him AT 85 אֶת et the~LIGHT 73 הָּאוֹר ha'or GIVEN.THAT 940 כִׁי ki FUNCTIONAL 848 טוֹב tov and~he~will~make~SEPARATE(V) 100 וַיַבְּדֵל wai'yav'deyl Elohiym POWER~s אֱלֹהִׁים e'lo'him BETWEEN 193 בֵין beyn the~LIGHT 73 הָּאוֹר ha'or and~BETWEEN 193 וּבֵין u'veyn the~DARKNESS 2439 הַחֹשֶךְ ha'hho'shekh
1:5 and~he~will~CALL.OUT(V) 2147 וַיִׁקְּרָּא wai'yiq'ra Elohiym POWER~s אֱלֹהִׁים e'lo'him to~LIGHT 73 לָּאוֹר la'or DAY 898 יוֹם
yom and~to~DARKNESS 2439 וְּלַחֹשֶךְ wê'la'hho'shekh he~did~CALL.OUT(V) 2147 קָּרָּא qa'ra NIGHT 1111 לָּיְּלָּה lai'lah and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi EVENING 2724 עֶרֶב e'rev and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi MORNING 1861 בֹקֶר
vo'qer DAY 898 יוֹם yom UNIT 636 אֶחָּד e'hhad
1:6 and~he~will~SAY(V) 1187 וַיֹאמֶר wai'yo'mer Elohiym POWER~s אֱלֹהִׁים e'lo'him he~will~EXIST(V) 505 יְּהִׁי yê'hi SHEET 2118 רָּקִׁיעַַ ra'qi'a in~MIDST 2631 בְּתוֹךְ bê'tokh the~WATER 1162~s2 הַמָּיִׁם ha'ma'yim and~he~will~EXIST(V) 505 וִׁיהִׁי wi'hi make~SEPARATE(V) 100~ing(ms) מַבְּדִׁיל mav'dil BETWEEN 193 בֵין beyn WATER 1162~s2 מַיִׁם ma'yim to~WATER 1162~s2 לָּמָּיִׁם la'ma'yim
1:7 and~he~will~DO(V) 1686 וַיַעַשׂ wai'ya'as Elohiym POWER~s אֱלֹהִׁים e'lo'him AT 85 אֶת et the~SHEET 2118 הָּרָּקִׁיעַַ ha'ra'qi'a and~he~will~make~SEPARATE(V) 100 וַיַבְּדֵל wai'yav'deyl BETWEEN 193 בֵין beyn the~WATER 1162~s2 הַמַיִׁם ha'ma'yim WHICH 2589 אֲשֶר a'sher from~UNDER 2627 מִׁתַחַת mi'ta'hhat to~SHEET 2118 לָּרָּקִׁיעַַ la'ra'qi'a and~BETWEEN 193 וּבֵין
u'veyn the~WATER 1162~s2 הַמַיִׁם ha'ma'yim WHICH 2589 אֲשֶר a'sher from~UPON 1616 מֵעַל mey'al to~SHEET 2118 לָּרָּקִׁיעַַ
la'ra'qi'a and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi SO 968 כֵן kheyn2
1:8 and~he~will~CALL.OUT(V) 2147 וַיִׁקְּרָּא wai'yiq'ra Elohiym POWER~s אֱלֹהִׁים e'lo'him to~SHEET 2118 לָּרָּקִׁיעַַ la'ra'qi'a SKY 2512~s2 שָּמָּיִׁם sha'ma'yim and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi EVENING 2724 עֶרֶב e'rev and~he~will~EXIST(V) 505 וַיְּהִׁי
wai'hi MORNING 1861 בֹקֶר vo'qer DAY 898 יוֹם yom SECOND 2541 שֵנִׁי shey'ni
1:9 and~he~will~SAY(V) 1187 וַיֹאמֶר wai'yo'mer Elohiym POWER~s אֱלֹהִׁים e'lo'him he~will~be~BOUND.UP(V) 2060 יִׁקָּווּ
yi'qaw'u the~WATER 1162~s2 הַמַיִׁם ha'ma'yim from~UNDER 2627 מִׁתַחַת mi'ta'hhat the~SKY 2512~s2 הַשָּמַיִׁם
ha'sha'ma'yim TO 26 אֶל el AREA 2092 מָּקוֹם ma'qom UNIT 636 אֶחָּד e'hhad and~she~be~SEE(V) 2185 וְּתֵרָּאֶה wê'tey'ra'eh the~DRY.GROUND 258 הַיַבָּשָּה hai'ya'ba'shah and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi SO 968 כֵן kheyn3
1:10 and~he~will~CALL.OUT(V) 2147 וַיִׁקְּרָּא wai'yiq'ra Elohiym POWER~s אֱלֹהִׁים e'lo'him to~DRY.GROUND 258 לַיַבָּשָּה
lai'ya'ba'shah LAND 2331 אֶרֶץ e'rets and~to~COLLECTION 2061 וּלְּמִׁקְּוֵה ul'miq'weh the~WATER 1162~s2 הַמַיִׁם ha'ma'yim he~did~CALL.OUT(V) 2147 קָּרָּא qa'ra SEA 895~s יַמִׁים ya'mim and~he~will~SEE(V) 2185 וַיַרְּא wai'yar Elohiym POWER~s אֱלֹהִׁים
e'lo'him GIVEN.THAT 940 כִׁי ki FUNCTIONAL 848 טוֹב tov
1 The skies and land are "fattened" In the sense of being "filled up."
2 The phrase "and he will exist so" means "and it is firmly established."
3 The phrase "and he will exist so" means "and it is firmly established."
The Mechanical Translation of the Torah The Book of Genesis
© Jeff A. Benner Page 3 www.mechanical-translation.org
............................................
1:22 and~he~will~much~KNEEL(V) 236 וַיְּבָּרֶךְ wai'va'rekh AT 85~them(mp) אֹתָּם o'tam Elohiym POWER~s אֱלֹהִׁים e'lo'him to~>~SAY(V) 1187 לֵאמֹר ley'mor !(mp)~REPRODUCE(V) 1858 פְּרוּ pê'ru and~!(mp)~INCREASE(V) 2197 וּרְּבוּ ur'vu and~!(mp)~FILL(V) 1192 וּמִׁלְּאוּ u'mil'u AT 85 אֶת et the~WATER 1162~s2 הַמַיִׁם ha'ma'yim in~the~SEA 895~s בַיַמִׁים
ba'ya'mim and~the~FLYER 1701 וְּהָּעוֹף wê'ha'oph he~did~INCREASE(V) 2197 יִׁרֶב yi'rev in~the~LAND 2331 בָּאָרֶץ ba'a'rets
1:23 and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi EVENING 2724 עֶרֶב e'rev and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi MORNING 1861 בֹקֶר vo'qer DAY 898 יוֹם yom FIFTH 1271 חֲמִׁישִׁי hha'mi'shi
1:24 and~he~will~SAY(V) 1187 וַיֹאמֶר wai'yo'mer Elohiym POWER~s אֱלֹהִׁים e'lo'him she~will~make~GO.OUT(V) 1922 תוֹצֵא
to'tsey the~LAND 2331 הָּאָרֶץ ha'a'rets BEING 1902 נֶפֶש ne'phesh LIVING 667 חַיָּה hhai'yah to~KIND 1216~her לְּמִׁינָּהּ
lê'mi'nah BEAST 178 בְּהֵמָּה bê'hey'mah and~TREADER 2313 וָּרֶמֶשׂ wa're'mes and~LIVING 667~him וְּחַיְּתוַֹ wê'hhai'to2 LAND 2331 אֶרֶץ e'rets to~KIND 1216~her לְּמִׁינָּהּ lê'mi'nah and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi SO 968 כֵן kheyn3
1:25 and~he~will~DO(V) 1686 וַיַעַשׂ wai'ya'as Elohiym POWER~s אֱלֹהִׁים e'lo'him AT 85 אֶת et LIVING 667 חַיַת hhai'yat the~LAND 2331 הָּאָרֶץ ha'a'rets to~KIND 1216~her לְּמִׁינָּהּ lê'mi'nah and~AT 85 וְּאֶת wê'et the~BEAST 178 הַבְּהֵמָּה
ha'be'hey'mah to~KIND 1216~her לְּמִׁינָּהּ lê'mi'nah and~AT 85 וְּאֵת wê'eyt ALL 957 כָּל kol TREADER 2313 רֶמֶשׂ re'mes the~GROUND 425 הָּאֲדָּמָּה ha'a'da'mah to~KIND 1216~him לְּמִׁינֵהוּ lê'mi'ney'hu and~he~will~SEE(V) 2185 וַיַרְּא wai'yar Elohiym POWER~s אֱלֹהִׁים e'lo'him GIVEN.THAT 940 כִׁי ki FUNCTIONAL 848 טוֹב tov
1:26 and~he~will~SAY(V) 1187 וַיֹאמֶר wai'yo'mer Elohiym POWER~s אֱלֹהִׁים e'lo'him we(cp)~will~DO(V) 1686 נַעֲשֶׂה na'a'seh HUMAN 424 אָדָּם a'dam in~IMAGE 1971~us(cp) בְּצַלְּמֵנוּ bê'tsal'mey'nu like~LIKENESS 431~us(cp) כִׁדְּמוּתֵנוּ kid'mu'tey'nu and~he~did~RULE(V) 2235 וְּיִׁרְּדוּ wê'yir'du in~FISH 395 בִׁדְּגַת vid'gat the~SEA 895 הַיָּם hai'yam and~in~FLYER 1701 וּבְּעוֹף
uv'oph the~SKY 2512~s2 הַשָּמַיִׁם ha'sha'ma'yim and~in~the~BEAST 178 וּבַבְּהֵמָּה u'va'be'hey'mah and~in~ALL 957 וּבְּכָּל
uv'khol the~LAND 2331 הָּאָרֶץ ha'a'rets and~in~ALL 957 וּבְּכָּל uv'khol the~TREADER 2313 הָּרֶמֶשׂ ha're'mes the~TREAD(V) 2312~ing(ms) הָּרֹמֵשׂ ha'ro'meys UPON 1616 עַל al the~LAND 2331 הָּאָרֶץ ha'a'rets
1:27 and~he~will~FATTEN(V) 232 וַיִׁבְּרָּא wai'yiv'ra Elohiym POWER~s אֱלֹהִׁים e'lo'him AT 85 אֶת et the~HUMAN 424 הָּאָדָּם
ha'a'dam in~IMAGE 1971~him בְּצַלְּמוַֹ bê'tsal'mo in~IMAGE 1971 בְּצֶלֶם bê'tse'lem Elohiym POWER~s אֱלֹהִׁים e'lo'him
1 This Hebrew word is translated in various ways including; whale, sea-monster, dragon, serpent, asp and jackal (see Exodus 7:9, Deuteronomy 32:33, Nehemiah 2:13, Job 7:12). According to these texts this is a very large creature and lives on the land and in the water, which are charecteristics of the crocodile.
2 The Hebrew literally reads "his living ones," but may be written defectively.
3 The phrase "and he existed so" Hebraicly means "and it is firmly established."
The Mechanical Translation of the Torah The Book of Genesis
© Jeff A. Benner Page 5 www.mechanical-translation.org
he~did~FATTEN(V) 232 בָּרָּא ba'ra AT 85~him אֹתוַֹ o'to MALE 1024 זָּכָּר za'khar and~FEMALE 2043 וּנְּקֵבָּה un'qey'vah he~did~FATTEN(V) 232 בָּרָּא ba'ra AT 85~them(mp) אֹתָּם o'tam
1:28 and~he~will~much~KNEEL(V) 236 וַיְּבָּרֶךְ wai'va'rekh AT 85~them(mp) אֹתָּם o'tam Elohiym POWER~s אֱלֹהִׁים e'lo'him and~he~will~SAY(V) 1187 וַיֹאמֶר wai'yo'mer to~them(mp) לָּהֶם la'hem Elohiym POWER~s אֱלֹהִׁים e'lo'him !(mp)~REPRODUCE(V) 1858 פְּרוּ pê'ru and~!(mp)~INCREASE(V) 2197 וּרְּבוּ ur'vu and~!(mp)~FILL(V) 1192 וּמִׁלְּאוּ u'mil'u AT 85 אֶת
et the~LAND 2331 הָּאָרֶץ ha'a'rets and~!(mp)~SUBDUE(V) 205~her וְּכִׁבְּשֻׁהַָּ wê'khiv'shu'ah and~!(mp)~RULE(V) 2235 וּרְּדוּ
ur'du in~FISH 395 בִׁדְּגַת bid'gat the~SEA 895 הַיָּם hai'yam and~in~FLYER 1701 וּבְּעוֹף uv'oph the~SKY 2512~s2 הַשָּמַיִׁם
ha'sha'ma'yim and~in~ALL 957 וּבְּכָּל uv'khol LIVING 667 חַיָּה hhai'yah the~TREAD(V) 2312~ing(fs) הָּרֹמֶשֶׂת ha'ro'me'set UPON 1616 עַל al the~LAND 2331 הָּאָרֶץ ha'a'rets
1:29 and~he~will~SAY(V) 1187 וַיֹאמֶר wai'yo'mer Elohiym POWER~s אֱלֹהִׁים e'lo'him LOOK 526 הִׁנֵה hin'neyh I(cs)~did~GIVE(V) 2659 נָּתַתִׁי na'ta'ti to~you(mp) לָּכֶם la'khem AT 85 אֶת et ALL 957 כָּל kol HERB 1691 עֵשֶׂב ey'sev SOW(V) 605~ing(ms) זֹרֵעַַ zo'rey'a SEED 606 זֶרַע ze'ra WHICH 2589 אֲשֶר a'sher UPON 1616 עַל al FACE 1815~s פְּנֵי pê'ney ALL 957 כָּל khol the~LAND 2331 הָּאָרֶץ ha'a'rets and~AT 85 וְּאֶת wê'et ALL 957 כָּל kol the~TREE 1706 הָּעֵץ ha'eyts WHICH 2589 אֲשֶר a'sher in~him בוַֹ bo PRODUCE 1859 פְּרִׁי phê'ri TREE 1706 עֵץ eyts SOW(V) 605~ing(ms) זֹרֵעַַ zo'rey'a SEED 606 זָּרַע za'ra to~you(mp) לָּכֶם la'khem he~will~EXIST(V) 505 יִׁהְּיֶה yih'yeh to~FOOD 949 לְּאָכְּלָּה lê'akh'lah
1:30 and~to~ALL 957 וּלְּכָּל ul'khol LIVING 667 חַיַת hhai'yat the~LAND 2331 הָּאָרֶץ ha'a'rets and~to~ALL 957 וּלְּכָּל ul'khol FLYER 1701 עוֹף oph the~SKY 2512~s2 הַשָּמַיִׁם ha'sha'ma'yim and~to~ALL 957 וּלְּכֹל ul'khol TREAD(V) 2312~ing(ms) רוֹמֵשׂ
ro'meys UPON 1616 עַל al the~LAND 2331 הָּאָרֶץ ha'a'rets WHICH 2589 אֲשֶר a'sher in~him בוַֹ bo BEING 1902 נֶפֶש ne'phesh LIVING 667 חַיָּה hhai'yah AT 85 אֶת et ALL 957 כָּל kol GREEN 2349 יֶרֶק ye'req HERB 1691 עֵשֶׂב ey'sev to~FOOD 949 לְּאָכְּלָּה
lê'akh'lah and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi SO 968 כֵן kheyn1
1:31 and~he~will~SEE(V) 2185 וַיַרְּא wai'yar Elohiym POWER~s אֱלֹהִׁים e'lo'him AT 85 אֶת et ALL 957 כָּל kol WHICH 2589 אֲשֶר
a'sher he~did~DO(V) 1686 עָּשָּׂה a'sah and~LOOK 526 וְּהִׁנֵה wê'hin'neyh FUNCTIONAL 848 טוֹב tov MANY 8 מְּאֹד mê'od and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi EVENING 2724 עֶרֶב e'rev and~he~will~EXIST(V) 505 וַיְּהִׁי wai'hi MORNING 1861 בֹקֶר
vo'qer DAY 898 יוֹם yom the~SIXTH 2613 הַשִׁשִׁי ha'shi'shi2

这是输出。主要的问题是v1:6和v1:23被完全忽略了。我想知道这是为什么以及如何解决它。你知道吗

这是输出文件。我把它浓缩了一点,把那些部分换成。。。。。。你知道吗

    1:1(0)in~SUMMIT(1)2363(2)בְּרֵאשִׁית(3)bê'rey'shit(4)he~did~FATTEN(V)(5)232(6)בָּרָּא(7)ba'ra(8)Elohiym(9)POWER~s(10)אֱלֹהִׁים(11)e'lo'him(12)AT(13)85(14)אֵת(15)eyt(16)the~SKY(17)2512~s2(18)הַשָּמַיִׁם(19)ha'sha'ma'yim(20)and~AT(21)85(22)וְּאֵת(23)wê'eyt(24)the~LAND(25)2331(26)הָּאָרֶץ(27)ha'a'rets(28)NumWordsInVerse(28)
    1:2(0)and~the~LAND(1)2331(2)וְּהָּאָרֶץ(3)wê'ha'a'rets(4)she~did~EXIST(V)(5)505(6)הָּיְּתָּה(7)hai'tah(8)CONFUSION(9)2623(10)תֹהוּ(11)to'hu(12)and~UNFILLED(13)106(14)וָּבֹהוּ(15)wa'vo'hu(16)and~DARKNESS(17)2439(18)וְּחֹשֶךְ(19)wê'hho'shekh(20)UPON(21)1616(22)עַל(23)al(24)FACE(25)1815~s(26)פְּנֵי(27)pê'ney(28)DEEP.SEA(29)522(30)תְּהוֹם(31)tê'hom(32)and~WIND(33)2251(34)וְּרוּחַַ(35)wê'ru'ahh(36)Elohiym(37)POWER~s(38)אֱלֹהִׁים(39)e'lo'him(40)much~FLUTTER(V)(41)787~ing(fs)(42)מְּרַחֶפֶת(43)mê'ra'hhe'phet(44)UPON(45)1616(46)עַל(47)al(48)FACE(49)1815~s(50)פְּנֵי(51)pê'ney(52)the~WATER(53)1162~s2(54)הַמָּיִׁם(55)ha'ma'yim(56)NumWordsInVerse(56)
    1:3(0)and~he~will~SAY(V)(1)1187(2)וַיֹאמֶר(3)wai'yo'mer(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)he~will~EXIST(V)(9)505(10)יְּהִׁי(11)yê'hi(12)LIGHT(13)73(14)אוֹר(15)or(16)and~he~will~EXIST(V)(17)505(18)וַיְּהִׁי(19)wai'hi(20)LIGHT(21)73(22)אוֹר(23)or(24)NumWordsInVerse(24)
    1:4(0)and~he~will~SEE(V)(1)2185(2)וַיַרְּא(3)wai'yar(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)AT(9)85(10)אֶת(11)et(12)the~LIGHT(13)73(14)הָּאוֹר(15)ha'or(16)GIVEN.THAT(17)940(18)כִׁי(19)ki(20)FUNCTIONAL(21)848(22)טוֹב(23)tov(24)and~he~will~make~SEPARATE(V)(25)100(26)וַיַבְּדֵל(27)wai'yav'deyl(28)Elohiym(29)POWER~s(30)אֱלֹהִׁים(31)e'lo'him(32)BETWEEN(33)193(34)בֵין(35)beyn(36)the~LIGHT(37)73(38)הָּאוֹר(39)ha'or(40)and~BETWEEN(41)193(42)וּבֵין(43)u'veyn(44)the~DARKNESS(45)2439(46)הַחֹשֶךְ(47)ha'hho'shekh(48)NumWordsInVerse(48)
    1:5(0)and~he~will~CALL.OUT(V)(1)2147(2)וַיִׁקְּרָּא(3)wai'yiq'ra(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)to~LIGHT(9)73(10)לָּאוֹר(11)la'or(12)DAY(13)898(14)יוֹם(15)yom(16)and~to~DARKNESS(17)2439(18)וְּלַחֹשֶךְ(19)wê'la'hho'shekh(20)he~did~CALL.OUT(V)(21)2147(22)קָּרָּא(23)qa'ra(24)NIGHT(25)1111(26)לָּיְּלָּה(27)lai'lah(28)and~he~will~EXIST(V)(29)505(30)וַיְּהִׁי(31)wai'hi(32)EVENING(33)2724(34)עֶרֶב(35)e'rev(36)and~he~will~EXIST(V)(37)505(38)וַיְּהִׁי(39)wai'hi(40)MORNING(41)1861(42)בֹקֶר(43)NumWordsInVerse(43)
    1:5(0)and~he~will~CALL.OUT(V)(1)2147(2)וַיִׁקְּרָּא(3)wai'yiq'ra(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)to~LIGHT(9)73(10)לָּאוֹר(11)la'or(12)DAY(13)898(14)יוֹם(15)yom(16)and~to~DARKNESS(17)2439(18)וְּלַחֹשֶךְ(19)wê'la'hho'shekh(20)he~did~CALL.OUT(V)(21)2147(22)קָּרָּא(23)qa'ra(24)NIGHT(25)1111(26)לָּיְּלָּה(27)lai'lah(28)and~he~will~EXIST(V)(29)505(30)וַיְּהִׁי(31)wai'hi(32)EVENING(33)2724(34)עֶרֶב(35)e'rev(36)and~he~will~EXIST(V)(37)505(38)וַיְּהִׁי(39)wai'hi(40)MORNING(41)1861(42)בֹקֶר(43)vo'qer(44)DAY(45)898(46)יוֹם(47)yom(48)UNIT(49)636(50)אֶחָּד(51)e'hhad(52)NumWordsInVerse(52)
    1:7(0)and~he~will~DO(V)(1)1686(2)וַיַעַשׂ(3)wai'ya'as(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)AT(9)85(10)אֶת(11)et(12)the~SHEET(13)2118(14)הָּרָּקִׁיעַַ(15)ha'ra'qi'a(16)and~he~will~make~SEPARATE(V)(17)100(18)וַיַבְּדֵל(19)wai'yav'deyl(20)BETWEEN(21)193(22)בֵין(23)beyn(24)the~WATER(25)1162~s2(26)הַמַיִׁם(27)ha'ma'yim(28)WHICH(29)2589(30)אֲשֶר(31)a'sher(32)from~UNDER(33)2627(34)מִׁתַחַת(35)mi'ta'hhat(36)to~SHEET(37)2118(38)לָּרָּקִׁיעַַ(39)la'ra'qi'a(40)and~BETWEEN(41)193(42)וּבֵין(43)u'veyn(44)the~WATER(45)1162~s2(46)הַמַיִׁם(47)ha'ma'yim(48)WHICH(49)2589(50)אֲשֶר(51)a'sher(52)from~UPON(53)1616(54)מֵעַל(55)mey'al(56)to~SHEET(57)2118(58)לָּרָּקִׁיעַַ(59)NumWordsInVerse(59)
    1:7(0)and~he~will~DO(V)(1)1686(2)וַיַעַשׂ(3)wai'ya'as(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)AT(9)85(10)אֶת(11)et(12)the~SHEET(13)2118(14)הָּרָּקִׁיעַַ(15)ha'ra'qi'a(16)and~he~will~make~SEPARATE(V)(17)100(18)וַיַבְּדֵל(19)wai'yav'deyl(20)BETWEEN(21)193(22)בֵין(23)beyn(24)the~WATER(25)1162~s2(26)הַמַיִׁם(27)ha'ma'yim(28)WHICH(29)2589(30)אֲשֶר(31)a'sher(32)from~UNDER(33)2627(34)מִׁתַחַת(35)mi'ta'hhat(36)to~SHEET(37)2118(38)לָּרָּקִׁיעַַ(39)la'ra'qi'a(40)and~BETWEEN(41)193(42)וּבֵין(43)u'veyn(44)the~WATER(45)1162~s2(46)הַמַיִׁם(47)ha'ma'yim(48)WHICH(49)2589(50)אֲשֶר(51)a'sher(52)from~UPON(53)1616(54)מֵעַל(55)mey'al(56)to~SHEET(57)2118(58)לָּרָּקִׁיעַַ(59)la'ra'qi'a(60)and~he~will~EXIST(V)(61)505(62)וַיְּהִׁי(63)wai'hi(64)SO(65)968(66)כֵן(67)kheyn2(68)NumWordsInVerse(68)
..............................
    1:19(0)and~he~will~EXIST(V)(1)505(2)וַיְּהִׁי(3)wai'hi(4)EVENING(5)2724(6)עֶרֶב(7)e'rev(8)and~he~will~EXIST(V)(9)505(10)וַיְּהִׁי(11)wai'hi(12)MORNING(13)1861(14)בֹקֶר(15)vo'qer(16)DAY(17)898(18)יוֹם(19)yom(20)FOURTH(21)2214(22)רְּבִׁיעִׁי(23)rê'vi'i(24)NumWordsInVerse(24)
    1:20(0)and~he~will~SAY(V)(1)1187(2)וַיֹאמֶר(3)wai'yo'mer(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)they(mp)~will~SWARM(V)(9)2341(10)יִׁשְּרְּצוּ(11)yish're'tsu(12)the~WATER(13)1162~s2(14)הַמַיִׁם(15)ha'ma'yim(16)SWARMER(17)2342(18)שֶרֶץ(19)she'rets(20)BEING(21)1902(22)נֶפֶש(23)ne'phesh(24)LIVING(25)667(26)חַיָּה(27)NumWordsInVerse(27)
    1:20(0)and~he~will~SAY(V)(1)1187(2)וַיֹאמֶר(3)wai'yo'mer(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)they(mp)~will~SWARM(V)(9)2341(10)יִׁשְּרְּצוּ(11)yish're'tsu(12)the~WATER(13)1162~s2(14)הַמַיִׁם(15)ha'ma'yim(16)SWARMER(17)2342(18)שֶרֶץ(19)she'rets(20)BEING(21)1902(22)נֶפֶש(23)ne'phesh(24)LIVING(25)667(26)חַיָּה(27)hhai'yah(28)and~FLYER(29)1701(30)וְּעוֹף(31)wê'oph(32)he~will~much~FLY(V)(33)1700(34)יְּעוֹפֵף(35)yê'o'pheyph(36)UPON(37)1616(38)עַל(39)al(40)the~LAND(41)2331(42)הָּאָרֶץ(43)NumWordsInVerse(43)
    1:21(0)and~he~will~FATTEN(V)(1)232(2)וַיִׁבְּרָּא(3)wai'yiv'ra(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)AT(9)85(10)אֶת(11)et(12)the~CROCODILE(13)2654~s(14)הַתַנִׁינִׁם(15)ha'ta'ni'nim1(16)the~GREAT(17)292~s(18)הַגְּדֹלִׁים(19)ha'ge'do'lim(20)and~AT(21)85(22)וְּאֵת(23)wê'eyt(24)ALL(25)957(26)כָּל(27)kol(28)BEING(29)1902(30)נֶפֶש(31)ne'phesh(32)the~LIVING(33)667(34)הַחַיָּה(35)ha'hha'yah(36)the~TREAD(V)(37)2312~ing(fs)(38)הָּרֹמֶשֶׂת(39)ha'ro'me'set(40)WHICH(41)2589(42)אֲשֶר(43)a'sher(44)they(mp)~did~SWARM(V)(45)2341(46)שָּרְּצוּ(47)shar'tsu(48)the~WATER(49)1162~s2(50)הַמַיִׁם(51)ha'ma'yim(52)to~KIND(53)1216~them(mp)(54)לְּמִׁינֵהֶם(55)NumWordsInVerse(55)
    1:21(0)and~he~will~FATTEN(V)(1)232(2)וַיִׁבְּרָּא(3)wai'yiv'ra(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)AT(9)85(10)אֶת(11)et(12)the~CROCODILE(13)2654~s(14)הַתַנִׁינִׁם(15)ha'ta'ni'nim1(16)the~GREAT(17)292~s(18)הַגְּדֹלִׁים(19)ha'ge'do'lim(20)and~AT(21)85(22)וְּאֵת(23)wê'eyt(24)ALL(25)957(26)כָּל(27)kol(28)BEING(29)1902(30)נֶפֶש(31)ne'phesh(32)the~LIVING(33)667(34)הַחַיָּה(35)ha'hha'yah(36)the~TREAD(V)(37)2312~ing(fs)(38)הָּרֹמֶשֶׂת(39)ha'ro'me'set(40)WHICH(41)2589(42)אֲשֶר(43)a'sher(44)they(mp)~did~SWARM(V)(45)2341(46)שָּרְּצוּ(47)shar'tsu(48)the~WATER(49)1162~s2(50)הַמַיִׁם(51)ha'ma'yim(52)to~KIND(53)1216~them(mp)(54)לְּמִׁינֵהֶם(55)lê'mi'ney'hem(56)and~AT(57)85(58)וְּאֵת(59)wê'eyt(60)ALL(61)957(62)כָּל(63)kol(64)FLYER(65)1701(66)עוֹף(67)oph(68)WING(69)984(70)כָּנָּף(71)ka'naph(72)to~KIND(73)1216~him(74)לְּמִׁינֵהוּ(75)lê'mi'ney'hu(76)and~he~will~SEE(V)(77)2185(78)וַיַרְּא(79)wai'yar(80)Elohiym(81)POWER~s(82)אֱלֹהִׁים(83)e'lo'him(84)GIVEN.THAT(85)940(86)כִׁי(87)ki(88)FUNCTIONAL(89)848(90)טוֹב(91)tov(92)NumWordsInVerse(92)
    1:22(0)and~he~will~much~KNEEL(V)(1)236(2)וַיְּבָּרֶךְ(3)wai'va'rekh(4)AT(5)85~them(mp)(6)אֹתָּם(7)o'tam(8)Elohiym(9)POWER~s(10)אֱלֹהִׁים(11)e'lo'him(12)to~>~SAY(V)(13)1187(14)לֵאמֹר(15)ley'mor(16)!(mp)~REPRODUCE(V)(17)1858(18)פְּרוּ(19)pê'ru(20)and~!(mp)~INCREASE(V)(21)2197(22)וּרְּבוּ(23)ur'vu(24)and~!(mp)~FILL(V)(25)1192(26)וּמִׁלְּאוּ(27)u'mil'u(28)AT(29)85(30)אֶת(31)et(32)the~WATER(33)1162~s2(34)הַמַיִׁם(35)ha'ma'yim(36)in~the~SEA(37)895~s(38)בַיַמִׁים(39)ba'ya'mim(40)and~the~FLYER(41)1701(42)וְּהָּעוֹף(43)wê'ha'oph(44)he~did~INCREASE(V)(45)2197(46)יִׁרֶב(47)yi'rev(48)in~the~LAND(49)2331(50)בָּאָרֶץ(51)ba'a'rets(52)NumWordsInVerse(52)
    1:24(0)and~he~will~SAY(V)(1)1187(2)וַיֹאמֶר(3)wai'yo'mer(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)she~will~make~GO.OUT(V)(9)1922(10)תוֹצֵא(11)to'tsey(12)the~LAND(13)2331(14)הָּאָרֶץ(15)ha'a'rets(16)BEING(17)1902(18)נֶפֶש(19)ne'phesh(20)LIVING(21)667(22)חַיָּה(23)hhai'yah(24)to~KIND(25)1216~her(26)לְּמִׁינָּהּ(27)NumWordsInVerse(27)
    1:24(0)and~he~will~SAY(V)(1)1187(2)וַיֹאמֶר(3)wai'yo'mer(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)she~will~make~GO.OUT(V)(9)1922(10)תוֹצֵא(11)to'tsey(12)the~LAND(13)2331(14)הָּאָרֶץ(15)ha'a'rets(16)BEING(17)1902(18)נֶפֶש(19)ne'phesh(20)LIVING(21)667(22)חַיָּה(23)hhai'yah(24)to~KIND(25)1216~her(26)לְּמִׁינָּהּ(27)lê'mi'nah(28)BEAST(29)178(30)בְּהֵמָּה(31)bê'hey'mah(32)and~TREADER(33)2313(34)וָּרֶמֶשׂ(35)wa're'mes(36)and~LIVING(37)667~him(38)וְּחַיְּתוַֹ(39)wê'hhai'to2(40)LAND(41)2331(42)אֶרֶץ(43)e'rets(44)to~KIND(45)1216~her(46)לְּמִׁינָּהּ(47)lê'mi'nah(48)and~he~will~EXIST(V)(49)505(50)וַיְּהִׁי(51)wai'hi(52)SO(53)968(54)כֵן(55)kheyn3(56)NumWordsInVerse(56)
    1:25(0)and~he~will~DO(V)(1)1686(2)וַיַעַשׂ(3)wai'ya'as(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)AT(9)85(10)אֶת(11)et(12)LIVING(13)667(14)חַיַת(15)hhai'yat(16)the~LAND(17)2331(18)הָּאָרֶץ(19)ha'a'rets(20)to~KIND(21)1216~her(22)לְּמִׁינָּהּ(23)lê'mi'nah(24)and~AT(25)85(26)וְּאֶת(27)wê'et(28)the~BEAST(29)178(30)הַבְּהֵמָּה(31)ha'be'hey'mah(32)to~KIND(33)1216~her(34)לְּמִׁינָּהּ(35)lê'mi'nah(36)and~AT(37)85(38)וְּאֵת(39)wê'eyt(40)ALL(41)957(42)כָּל(43)kol(44)TREADER(45)2313(46)רֶמֶשׂ(47)re'mes(48)the~GROUND(49)425(50)הָּאֲדָּמָּה(51)ha'a'da'mah(52)to~KIND(53)1216~him(54)לְּמִׁינֵהוּ(55)lê'mi'ney'hu(56)and~he~will~SEE(V)(57)2185(58)וַיַרְּא(59)wai'yar(60)Elohiym(61)POWER~s(62)אֱלֹהִׁים(63)e'lo'him(64)GIVEN.THAT(65)940(66)כִׁי(67)ki(68)FUNCTIONAL(69)848(70)טוֹב(71)tov(72)NumWordsInVerse(72)
    1:26(0)and~he~will~SAY(V)(1)1187(2)וַיֹאמֶר(3)wai'yo'mer(4)Elohiym(5)POWER~s(6)אֱלֹהִׁים(7)e'lo'him(8)we(cp)~will~DO(V)(9)1686(10)נַעֲשֶׂה(11)na'a'seh(12)HUMAN(13)424(14)אָדָּם(15)a'dam(16)in~IMAGE(17)1971~us(cp)(18)בְּצַלְּמֵנוּ(19)bê'tsal'mey'nu(20)like~LIKENESS(21)431~us(cp)(22)כִׁדְּמוּתֵנוּ(23)kid'mu'tey'nu(24)and~he~did~RULE(V)(25)2235(26)וְּיִׁרְּדוּ(27)wê'yir'du(28)in~FISH(29)395(30)בִׁדְּגַת(31)vid'gat(32)the~SEA(33)895(34)הַיָּם(35)hai'yam(36)and~in~FLYER(37)1701(38)וּבְּעוֹף(39)uv'oph(40)the~SKY(41)2512~s2(42)הַשָּמַיִׁם(43)ha'sha'ma'yim(44)and~in~the~BEAST(45)178(46)וּבַבְּהֵמָּה(47)u'va'be'hey'mah(48)and~in~ALL(49)957(50)וּבְּכָּל(51)NumWordsInVerse(51)

这是我的终端输出调试数据,以备不时之需

    1:1  in~SUMMIT(0)

1:2  and~the~LAND(1)

or[nextGlitch][index:2]
1:3  and~he~will~SAY(V)(2)

1:4  and~he~will~SEE(V)(3)

yom[nextGlitch][index:4]
1:5  and~he~will~CALL.OUT(V)(4)

vo'qer[curGlitch][index:5]
1:5  and~he~will~CALL.OUT(V)(5)

u'veyn[nextGlitch][index:6]
1:7  and~he~will~DO(V)(6)

la'ra'qi'a[curGlitch][index:7]
1:7  and~he~will~DO(V)(7)

wai'hi[curGlitch][index:8]
1:8  and~he~will~CALL.OUT(V)(8)

yi'qaw'u[cur&nextGlitch][index:9]
1:9  and~he~will~SAY(V)(9)

lai'ya'ba'shah[nextGlitch][index:10]
1:10  and~he~will~CALL.OUT(V)(10)

e'lo'him[cur&nextGlitch][index:11]
2[nextGlitch][index:11]
Bad Data
3[cur&nextGlitch][index:12]
©[nextGlitch][index:12]
Bad Data
tad'shey[nextGlitch][index:13]
1:11  and~he~will~SAY(V)(13)

maz'ri'a[cur&nextGlitch][index:14]
1:11  and~he~will~SAY(V)(14)

lê'mi'ney'hu[nextGlitch][index:15]
1:12  and~she~will~make~GO.OUT(V)(15)

1:13  and~he~will~EXIST(V)(16)

u'veyn[nextGlitch][index:17]
1:14  and~he~will~SAY(V)(17)

wê'sha'nim[curGlitch][index:18]
1:14  and~he~will~SAY(V)(18)

ha'a'rets[curGlitch][index:19]
1:15  and~they(cp)~did~EXIST(V)(19)

ha'ma'or[cur&nextGlitch][index:20]
1:16  and~he~will~DO(V)(20)

al[nextGlitch][index:21]
1:17  and~he~will~GIVE(V)(21)

e'lo'him[nextGlitch][index:22]
1:18  and~to~>~REGULATE(V)(22)

1[cur&nextGlitch][index:23]
3[nextGlitch][index:23]
Bad Data
4[cur&nextGlitch][index:24]
©[nextGlitch][index:24]
Bad Data
1:19  and~he~will~EXIST(V)(25)

yish're'tsu[nextGlitch][index:26]
1:20  and~he~will~SAY(V)(26)

hhai'yah[cur&nextGlitch][index:27]
1:20  and~he~will~SAY(V)(27)

ne'phesh[nextGlitch][index:28]
1:21  and~he~will~FATTEN(V)(28)

lê'mi'ney'hem[curGlitch][index:29]
1:21  and~he~will~FATTEN(V)(29)

ba'ya'mim[curGlitch][index:30]
1:22  and~he~will~much~KNEEL(V)(30)

to'tsey[nextGlitch][index:31]
1:24  and~he~will~SAY(V)(31)

lê'mi'nah[curGlitch][index:32]
1:24  and~he~will~SAY(V)(32)

ha'be'hey'mah[curGlitch][index:33]
1:25  and~he~will~DO(V)(33)

uv'oph[cur&nextGlitch][index:34]
1:26  and~he~will~SAY(V)(34)

ha'a'dam[nextGlitch][index:35]
1:27  and~he~will~FATTEN(V)(35)

1[cur&nextGlitch][index:36]
3[nextGlitch][index:36]
Bad Data
The[cur&nextGlitch][index:37]
he~did~FATTEN(V)[nextGlitch][index:37]
Bad Data
et[nextGlitch][index:38]
1:28  and~he~will~much~KNEEL(V)(38)

ur'du[cur&nextGlitch][index:39]
1:28  and~he~will~much~KNEEL(V)(39)

1:29  and~he~will~SAY(V)(40)

ro'meys[nextGlitch][index:41]
1:30  and~to~ALL(41)

lê'akh'lah[curGlitch][index:42]
1:30  and~to~ALL(42)

a'sher[cur&nextGlitch][index:43]
1:31  and~he~will~SEE(V)(43)

Tags: andthetoinloindexwilllist
1条回答
网友
1楼 · 发布于 2024-06-13 09:34:23

我从您的代码中猜测您正在同时迭代和修改列表,这将给您带来意想不到的结果。使用两个列表,一个用于从文件中读取的数据,另一个用于新数据。看看这个不相关的例子:

>>> l = range(10)
>>> l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> for i in l:
...   print(i)
...   x = l.pop()
... 
0
1
2
3
4

我还有几件事要补充:

使用with关键字打开和关闭文件(用于读取和写入):

lines_list = None
with open('<your_file>') as handler:  # this will take care of closing the file for you
    lines_list = handler.read().splitlines()

知道何时使用括号,这是:

if ( (word_list[0].isdigit() < 8) and (':' not in word_list[0]) ) and concatenateNext_string_TF( index, lines_list):

同:

if word_list[0].isdigit() < 8 and ':' not in word_list[0] and concatenateNext_string_TF(index, lines_list):

相关问题 更多 >