Skip to content

Instantly share code, notes, and snippets.

@berensn
Created April 30, 2019 20:24
Show Gist options
  • Save berensn/ce8fd83cb4e4d05e5c4174bde273625e to your computer and use it in GitHub Desktop.
Save berensn/ce8fd83cb4e4d05e5c4174bde273625e to your computer and use it in GitHub Desktop.
CSV Maker
import csv
import random
with open ('rando_numero.csv', 'w', newline = '') as csvfile:
fw = csv.writer(csvfile, delimiter=',', quoting=csv.QUOTE_ALL)
for i in range(13):
csv_list = []
for j in range(15):
rando_selecto = random.randint(1, 10)
if rando_selecto == 1:
pre = random.randint(1, 999)
else:
pre = random.randint(1,99)
suf = random.randint(1, 99)
if suf < 10:
suf = f'0{suf}'
csv_list.append(f'{pre},{suf}')
fw.writerow(csv_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment