#!/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())
局域网文件访问
猜你喜欢
转载自blog.csdn.net/weixin_43069769/article/details/108723105
今日推荐
周排行