Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65f702e

Browse files
committed
Random number file
1 parent3ab2cf9 commit65f702e

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+
importrandom
2+
importos
3+
4+
defrandom_file(file_path):
5+
file_write=open(file_path,"a+")
6+
file_read=open(file_path,"r")
7+
foriinrange(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)

[8]ページ先頭

©2009-2025 Movatter.jp