Created
July 28, 2013 07:21
-
-
Save saiias/6097803 to your computer and use it in GitHub Desktop.
0-500の整数のペアを指定した行数生成するスクリプト(csv)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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