D
D
Dima2021-06-14 21:22:08
Python
Dima, 2021-06-14 21:22:08

How to make numbers appear on a new line, and not in one?

import random
import time

while True:
    time.sleep(0.10)
    with open("find.txt", "a") as file:
        for i in range(8):
            a = random.randint(1, 9)
            file.write(str(a))
    file.close()


it turns out: 62135457478176393894952224388141911487493933511942484696734237544717466723779738787746727979311699462377575911892166846597235769921552223663713716821587652568181511457145237959815197833175864411

How do you make it so:
12,357,652
54,671,455
12,345,346
70,647,458
13,429,539

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-06-14
@interneterrorhehe

file.write('\n') after inner loop.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question