Issue
I need some code that will split password into multiple strings where there is a space and that i can then check if that is a a word in wordnet, does anyone know how to do this.
checker = str.split(password)
if wordnet.synsets(checker):
print("your password is: "+ password)
nextcheck = True
Solution
Here is an example
password = "This is a password"
# split the input string
split_password = password.split()
# iterate through the words in split_password
for word in split_password:
# get the sysnet list for each word
sysnet_list = wordnet.synsets(word)
# here you can do whatever you need with every element of the list
# so print it if you like
if sysnet_list:
for potential_password in sysnet_list:
print(f"Your password is {potential_password}")
else:
print(f"No potential password found for {word}")
Answered By - voltux
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.