Python - difference between two strings

前端 未结 5 1663
余生分开走
余生分开走 2020-11-27 13:41

I\'d like to store a lot of words in a list. Many of these words are very similar. For example I have word afrykanerskojęzyczny and many of words like afr

5条回答
  •  一向
    一向 (楼主)
    2020-11-27 14:16

    The answer to my comment above on the Original Question makes me think this is all he wants:

    loopnum = 0
    word = 'afrykanerskojęzyczny'
    wordlist = ['afrykanerskojęzycznym','afrykanerskojęzyczni','nieafrykanerskojęzyczni']
    for i in wordlist:
        wordlist[loopnum] = word
        loopnum += 1
    

    This will do the following:

    For every value in wordlist, set that value of the wordlist to the origional code.

    All you have to do is put this piece of code where you need to change wordlist, making sure you store the words you need to change in wordlist, and that the original word is correct.

    Hope this helps!

提交回复
热议问题