python起一个固定端口

python3

python -m http.serve [port]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# python -m http.server --help

[root@hadoop01 ~]# python3 -m http.server --help
usage: server.py [-h] [--cgi] [--bind ADDRESS] [--directory DIRECTORY] [port]

positional arguments:
port Specify alternate port [default: 8000]

optional arguments:
-h, --help show this help message and exit
--cgi Run as CGI Server
--bind ADDRESS, -b ADDRESS
Specify alternate bind address [default: all
interfaces]
--directory DIRECTORY, -d DIRECTORY
Specify alternative directory [default:current
directory]

python2

python -m SimpleHTTPServer [port]

-------------本文结束感谢您的阅读-------------