0

new some help here. I need the printed text in a .txt file instead of showing in run. Cant seem to figure this thing out...

import random
import string
import itertools

def randomString(stringLength=3):
    letters = string.ascii_lowercase
    return ''.join(random.choice(letters) for i in range(stringLength))

num = 10
for i in itertools.repeat(num):
    print(randomString(3) + str(random.randint(10, 99)) + (randomString(3)))
  • 1
    Does this answer your question? [Correct way to write line to file?](https://stackoverflow.com/questions/6159900/correct-way-to-write-line-to-file) – Brian Mar 04 '22 at 21:13

0 Answers0