FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Basic-Python-Programs/csvgen.py at main · gitishman/Basic-Python-Programs · GitHub
gitishman
/
Basic-Python-Programs
Public
forked from
souravjain540/Basic-Python-Programs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Basic-Python-Programs
/
csvgen.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
16 lines (11 loc) · 608 Bytes
Breadcrumbs
Basic-Python-Programs
/
csvgen.py
Copy path
File metadata and controls
16 lines (11 loc) · 608 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#This file generates a CSV file with integer values,
# Use cases: you can use it for eg. input for testing your sroting algorithms and other program inputs when you need to test with large data.
import
random
as
rd
;
minNum
=
0
;
maxNum
=
1000
;
#maximum number in array
lengthOfItems
=
500
;
#this will generate 500 random numbers.
file
=
open
(
"newFile.csv"
,
"a"
)
# creates a new file named newFile.csv - feel free to edit file name
for
i
in
range
(
lengthOfItems
):
file
.
write
(
str
(
str
(
rd
.
randint
(
minNum
,
maxNum
))
+
","
))
file
.
close
()
#note - you will have to split first line at "," and convert to int
Back
|
FazBrowse Home
|
New Git URL