A collection of sloppy snippets for scientific computing and data visualization in Python.
Showing posts with label
string
.
Show all posts
Showing posts with label
string
.
Show all posts
Tuesday, June 28, 2011
Searching for IP address using regular expression
›
This snippet finds an IP address in a string using regex: import re ip = re.compile('(([2][5][0-5]\.)|([2][0-4][0-9]\.)|([0-1]?[0-9]?[0-...
Monday, May 16, 2011
How to create an Irc echo bot
›
The example shows how to connect to an irc server and how to read and send data from the server. import socket def reply(privmsg, socket):...
Friday, May 6, 2011
How to use string's Template
›
Templates provide simple string substitutions mechanism, here's a simple demonstration: from string import Template template = Template...
›
Home
View web version