[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Thu Jan 27 17:53:18 2005 -->
- <!--x-from-r13: psbjyre ng bhgcbfgfragvary.pbz (Quevfgbcure Tbjyre) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] -->
- <!--x-reference: -->
- <!--x-reference: [email protected] -->
- <!--x-reference: 41F7CF8F.6040200@proteus-tech.com -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Py[h]hon syntax (sic) -->
- <li><em>date</em>: Thu Jan 27 17:53:18 2005</li>
- <li><em>from</em>: cfowler at outpostsentinel.com (Christopher Fowler)</li>
- <li><em>in-reply-to</em>: <<a href="msg01215.html">[email protected]</a>></li>
- <li><em>references</em>: <<a href="msg01121.html">[email protected]</a>> < > <<a href="msg01129.html">[email protected]</a>> < > <<a href="msg01133.html">[email protected]</a>> <<a href="msg01207.html">[email protected]</a>> <<a href="msg01215.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] Py[h]hon syntax (sic)</li>
On Thu, 2005-01-27 at 14:49, John P. Healey wrote:
> the code for pinging would look something like this:
>
> import os
> import re
>
> def ping(ip, tries = 2):
> my_re = re.compile('(\w|\W)+ (\d) received, (\w|\W)+')
> for attempt in range(tries):
> ping_in, ping_out = os.popen2("ping -c 1 %s" % ip)
> for line in ping_out:
> rec_match = my_re.match(line)
> if not rec_match: continue
> received = int(rec_match.groups()[1])
> if not received: continue
> return attempt + 1
> return False
>
> it takes an optional second argument (# of tries) and returns the number of
> tries needed when successful, False otherwise. the SMTP stuff can be handled
> with smtplib. it's part of the standard library. the main python site has
> pretty good documentation on this, including example code:
>
> <a rel="nofollow" href="http://docs.python.org/lib/module-smtplib.html">http://docs.python.org/lib/module-smtplib.html</a>
>
>
> 5265762e204a6f686e6e79204865616c6579
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> <a rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale">http://www.ale.org/mailman/listinfo/ale</a>
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="01121" href="msg01121.html">[ale] Pyhon syntax</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (fletch at phydeaux.org)</li></ul></li>
<li><strong><a name="01129" href="msg01129.html">[ale] Pyhon syntax</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="01133" href="msg01133.html">[ale] Py[h]hon syntax (sic)</a></strong>
<ul><li><em>From:</em> scherrey at proteus-tech.com (Benjamin Scherrey)</li></ul></li>
<li><strong><a name="01207" href="msg01207.html">[ale] Py[h]hon syntax (sic)</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="01215" href="msg01215.html">[ale] Py[h]hon syntax (sic)</a></strong>
<ul><li><em>From:</em> jpheale at LearnLink.Emory.Edu (John P. Healey)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg01231.html">[ale] OT: Scrum and Extended Development</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg01233.html">[ale] Py[h]hon syntax (sic)</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg01215.html">[ale] Py[h]hon syntax (sic)</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg01233.html">[ale] Py[h]hon syntax (sic)</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#01232"><strong>Date</strong></a></li>
<li><a href="threads.html#01232"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>