Pythonのお勉強 Part31at TECH
Pythonのお勉強 Part31 - 暇つぶし2ch283:デフォルトの名無しさん
09/01/20 15:25:18
>>206
#!/usr/bin/env python
# -*- coding: ascii -*-

import socket
import sys

try:
    host, frm, to = sys.argv[1: 4]
except ValueError:
    print "Usage: %s <host> <from> <to>" % (sys.argv[0])
    sys.exit(1)

print "Connecting to %s:25 ..." % (host)

sock = socket.socket()
try:
    idx = host.index(':')
except ValueError:
    addr = (host, 25)
else:
    addr = (host[:idx], int(host[idx + 1:]))
sock.connect(addr)

print "Connected"


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch