#coding =utf-8
Import Random
Import time
Import datetime
Timestart = ' 2016-06-04 10:00:01 '
#increase time, string to time, then add seconds-want, at last, time to string
def increasetime (base_time):
Date_time = Datetime.datetime.strptime (Base_time, '%y-%m-%d%h:%m:%s ') #string to datetime
Time_time = Time.mktime (Date_time.timetuple ()) #datetime to timestamp datetime.datetime (2016, 6, 4, 10, 0, 1)
Time_time = time_time + 1 #1465005606.0
New_time = Time.strftime ('%y-%m-%d%h:%m:%s ', Time.localtime (time_time)) # ' 2016-06-04 10:00:06 '
Return New_time
Def createtimeset ():
Time = Timestart;
F=open (' Column.txt ', ' W ')
For I in Range (1,101):
F.write (str (time) + ' \ n ')
If i%3 = = 0:
Print I
Time=increasetime (Time)
F.close ()
Macstart = 1;
def increasemac (Macparam):
Return (Macparam + 1)
Def createmacset ():
Mac = Macstart
F=open (' Mac.txt ', ' W ')
For I in Range (1,101):
Macstr = '%012x '% mac
Macstr = macstr[0]+macstr[1]+ ': ' + macstr[2]+macstr[3]+ ': ' +macstr[4]+macstr[5]+ ': ' +macstr[6]+macstr[7]+ ': ' +macstr[ 8]+macstr[9]+ ': ' +macstr[10]+macstr[11]
F.write (macstr + ' \ n ')
Mac=mac+1
If i%3 = = 0:
Mac=macstart
F.close ()
Arrx=[]
Arry=[]
def initarrx (length):
For I in range (length):
X = Random.randint (0, 1000)
Arrx.append (X)
Print Arrx
def initarry (length):
For I in range (length):
Y = Random.randint (0, 640)
Arry.append (Y)
Print Arry
Def createxyset ():
Initarrx (3)
Initarry (3)
F=open (' Xy.txt ', ' W ')
For I in Range (0,100):
F.write (str (arrx[i%3]) + ' \ n ')
ARRX[I%3] = arrx[i%3] + random.randint (-1, 1)
F.close ()
#for i in range (0,100):
#f. Write (str (arr[i%3]) + ' \ n ')
#arr [i%3] = arr[i%3] + random.randint (-1, 1)
Python Construction Data 1_column.py