单线Python网

2024-03-29 09:59:56 发布

您现在位置:Python中文网/ 问答频道 /正文


Tags: python
2条回答

我敢肯定你不能让一个web服务器在一行代码中使用sockets和select()。即使不使用分号,也必须有一些循环和控制结构。

你确定这不是你要找的吗?

$ python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 ...

Python 3版本:python -m http.server 8000

可能是perlfavourite one liners

perl -MIO::All -e 'io(":8080")->fork->accept->(sub { $_[0] < io(-x $1 +? "./$1 |" : $1) if /^GET \/(.*) / })'

相关问题 更多 >