Python

    版本為 20:38, 20 Nov 2024

    到這個版本。

    返回到 版本存檔.

    查閱目前版本

    Python Samples

    內建的 http server

    http://effbot.org/librarybook/simplehttpserver.htm

    # File: simplehttpserver-example-1.py
    
    import SimpleHTTPServer
    import SocketServer
    
    # minimal web server.  serves files relative to the
    # current directory.
    
    PORT = 8000
    
    Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
    
    httpd = SocketServer.TCPServer(("", PORT), Handler)
    
    print "serving at port", PORT
    httpd.serve_forever()
    

    建立一個檔案上傳的 Web-UI
    需要檔案: droppy.py
    假設要上傳檔案的儲存路徑為 ~/upload

    cd ~/upload
    python ~/bin/droopy.py -m "Hi, it's me Bob. You can send me a file."

    - help 可以顯示更多參數

    取得 eth0 IP 位址

    reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)

    播放 IP 位址的語音

    reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)
    Powered by MindTouch Core