码迷,mamicode.com
首页 > 编程语言 > 详细

python构造数据

时间:2016-06-30 12:18:10      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:

#coding=utf-8
import random
import time


def createRandomMac():
Maclist = []
for i in range(1,7):
RANDSTR = "".join(random.sample("0123456789abcdef",2))
Maclist.append(RANDSTR)
RANDMAC = ":".join(Maclist)
print RANDMAC

def createRandomX():
return random.randint(0, 1000)


def createRandomY():
return random.randint(0, 640)

def createTime():
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

def creataLine():

def createDataSet():
f=open(‘1.txt‘,‘w‘)
for i in range(10):
X,Y,time=creataLine();
f.write(str(time) + ‘,‘ + str(X) + ‘,‘ + str(Y) + ‘\n‘)

python构造数据

标签:

原文地址:http://www.cnblogs.com/zhengchunhao/p/5557233.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!