1.一个项目需要启动多个文件时可以制作一个脚本.
import os
import time
import random
elasticsearch = r'C:elasticsearch-6.5.4inelasticsearch.bat' #项目启动的路径
kibana = r'C:elasticsearch-6.5.4kibana-6.5.4-windows-x86_64inkibana.bat' #项目启动的路径
def progress_bar(item):
for i in range(11, 0, -1):
if item == 'kibana':
time.sleep(random.random() + 0.8)
else:
time.sleep(random.random() + 0.4)
res = '
%s正在加载:%s %s%%
' % (item, ('████' * (12 - i)), (11 - i) * 10) if i == 1 else '
%s正在加载:%s %s%%' % (
item,
(
'████' * (
12 - i)),
(11 - i) * 10)
print(' 33[31m%s 33[0m' % res, end='')
def run():
for item in [(elasticsearch, 'elasticsearch'), (kibana, 'kibana')]:
os.system('start %s' % item[0])
progress_bar(item[1])
time.sleep(10)
if __name__ == '__main__':
run()
2.打包
https://www.cnblogs.com/changtao/p/10269256.html