Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- words = r"C:usersCecewords.txt"
- lines = [line.rstrip('n') for line in open(words)]
- wordsC = lines
- randword = random.choice(wordsC)
- while randword == 5:
- if len(randword) == 5:
- word = randword.upper()
- myword = list(word)
- else:
- pass
- with open(r"C:usersCecewords.txt") as f:
- words_5 = []
- for line in f:
- word = line.strip()
- if len(word) == 5:
- words_5.append(word.upper())
- lines = [line.rstrip('n') for line in open(words) if len(line.rstrip('n')) == 5]
- randword = random.choice(wordsC)
- randword = random.choice(wordsC)
- while len(randword) != 5:
- randword = random.choice(wordsC)
- word = randword.upper()
- myword = list(word)
- import random
- def take_random_5(l):
- randword = random.choice(l)
- if len(randword) != 5:
- return
- return randword
- words = r"C:usersCecewords.txt"
- lines = [line.rstrip('n') for line in open(words)]
- while True:
- take_random_5(lines)
- import random
- filename = r"C:usersCecewords.txt"
- with open(filename) as f:
- content = f.readlines()
- # you may also want to remove whitespace characters like `n` at the end of each line
- content = [x.strip() for x in content]
- words5 = []
- for x in content:
- if len(x) == 5:
- words5.extend(x)
- print(random.choice(words5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement