Skip to content

Instantly share code, notes, and snippets.

@saiias
Created July 28, 2013 07:21
Show Gist options
  • Save saiias/6097803 to your computer and use it in GitHub Desktop.
Save saiias/6097803 to your computer and use it in GitHub Desktop.
0-500の整数のペアを指定した行数生成するスクリプト(csv)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import random
import sys
import csv
def main():
if len(sys.argv) < 2:
print "usage:please input number of line"
exit()
lines = int(sys.argv[1])
filename = "sample_input.csv"
writer = csv.writer(file(filename, 'w'))
for i in xrange(lines):
writer.writerow([random.randint(0, 500), random.randint(0, 500)])
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment