로컬 웹 서비스 다운로드 파일
4031 단어 python 코드 통합
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : locatin_web_page.py
@Time : 2020/09/22 07:20:20
@Author : manman
@Contact : [email protected]
@Department : my-self
@Desc : None
'''
# here put the import lib
from os import getcwd
import subprocess
def local_web_page(portnumber=8080):
try:
cmd1 = subprocess.getoutput('cd ~')
cmd2 = subprocess.getoutput('ifconfig | grep "inet " | grep -v 127.0.0.1')
print_str = "{}{}{}".format(cmd2.split()[1],":","8080")
print(" :",print_str," ")
cmd3 = subprocess.getoutput('python3 -m http.server ' + portnumber.__repr__())
except KeyboardInterrupt:
cmd4 = subprocess.getoutput('cd '+ getcwd())
cmd5 = subprocess.getoutput('pwd')
if __name__ == '__main__':
print(local_web_page())