say you have a string, where P = "hello"
how do I split this into individual characters, so I can use indexing.
what I aim to do is replace a letter in P, (e.g h) with a letter in the alpphabet. I want to for loop this so when a new word, e.g hillo with e replaced, is in a seperate list of strings, it will make a list with all these words together. I tried listing, but that doesn't work as I couldn't do the skrt[letter] = alphabet.pop(item).
anagrams = {}
L = []
C = []
alphabet = "abcdefghijklmnopqrstuvwxyz"
alphabet = sorted(alphabet)
print(alphabet)
lines = open("words.txt", "r").readlines()
for word in lines:
stripped = word.strip().lower()
L.append(stripped)
for letter in word:
for item in alphabet:
skrt = list(word)
print(skrt)
skrt[letter] = alphabet.pop(item)
"".join(skrt)
if skrt in L:
C.append(skrt)
print(C)