Demo entry 6339611

   

Submitted by anonymous on Dec 23, 2016 at 06:27
Language: Python. Code size: 623 Bytes.

#!/usr/bin/python
# -*- coding:UTF-8 -*-

import os
import datetime

buildInfoDict = {}

#获取电脑名称
hostname = os.popen('hostname').read()
buildInfoDict['hostname'] = hostname

#获取打包时间
buildtime = datetime.datetime.now()
buildInfoDict['buildtime'] = str(buildtime)



buildInfoLog = []
for key,value in buildInfoDict.items():
	buildInfoLog.append(key)
	buildInfoLog.append('\r\n')
	buildInfoLog.append(value)
	buildInfoLog.append('\r\n')
	buildInfoLog.append('\r\n')

print ''.join(buildInfoLog)


with open('${SRCROOT}/Test/BuildInfo.txt','wb+') as f:
	f.write(''.join(buildInfoLog))

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).