Skip to content

Commit 65f702e

Browse files
committed
Random number file
1 parent 3ab2cf9 commit 65f702e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lab-12/random-number-file.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import random
2+
import os
3+
4+
def random_file(file_path):
5+
file_write = open(file_path, "a+")
6+
file_read = open(file_path, "r")
7+
for i in range(100):
8+
file_write.write(f" {str(random.randint(0, 100))} ")
9+
print(file_read.read())
10+
open(file_path).close()
11+
12+
random_file(os.path.expanduser('~') + "\\src\\python-programming\\lab-12\\test.txt")

0 commit comments

Comments
 (0)