python执行shell脚本读取Linux中的文件
# /usr/bin/python3
# -*- coding: utf-8 -*-
# python脚本中要执行一个脚本,并读取文件中的数据
import os
import codecs
import sys
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
#执行shell脚本
os.system('sh /home/sino/check_jk.sh > check_up.txt')
#读取文件
file_name = '/home/sino/check_up.txt'
with open(file_name,encoding='utf-8') as file_list:
file_jc = file_list.readlines()