Simple Python Clipboard RegEX Parser

Here is some Python code which will manipulate data copied to your clipboard. Just CRTL-C your data, run this Python script with your REGEX manipulators and paste back to the target. I leveraged this concept from Tim Koopmans (thanks Tim), but did a python implementation rather than perl.
Continue reading

Online Regular Expression Tester

To minimize writing chunks, of code regular expressions can save a heap of work. The downside to this, is that sometimes they can be hard to read, build or test.

To save more time in building and testing your regular expression use a Regular Expression tester. An online regular expression tester that I use often is this one. Does pretty much everything you would need. Test out your regular expressions quickly before using them in any of your favorite scripting or programming languages.
Continue reading

The Simplest HTTP Server Ever

This one in from John Strumila (Thanks for sharing John)

i just have to share this with you guys coz it’s so handy:

to create your own web server, do this with python.

"python -m SimpleHTTPServer 8000"

this will serve up any files you have in that directory. ie. to get file “yy”:

Just amazing.

Using Python to connect to Oracle DB, and extract results to CSV

I knew it would’nt take much code to do this, but there was still a little fiddling around and some odd errors along the way. Anyhow if you want to do this here is some helpful tips
Continue reading


When using the pysaprfc library you may encounter this error when performing a RFC_READ_TABLE. The reason for this is primarily because the table has too many fields to draw back into the itable python structure of the pysaprfc library. To overcome this you will need to limit the number of fields being returned in the read_table method as shown in this code below. By the way this particular code snippet is also useful for drawing back iDoc status codes for a list of iDoc numbers. Especially useful if you are having trouble getting read only access directly to the database as we were 🙂

import pysap

# Variables
WhereSQL = "DOCNUM IN (2016, 2017, 2018)"
SQLTable = "EDIDS"
MaxRows = "50"
CONN_FILE = "C:/Python26/pysaprfc/examples/sapconn.ini"

# Change next line to be able to connect to your SAP system

# Read entries from SQLTable
# Print some fields from itab to show it worked
for p in itab:
print '%(DOCNUM)s %(LOGDAT)s %(LOGTIM)s %(CREDAT)s %(CRETIM)s %(STATUS)s %(STACOD)s %(STATXT)s %(STAMQU)s %(STAMID)s ' % p