<ANNOUNCE> Python Utils - dataenc.py NEW
http://www.voidspace.org.uk/atlantibots/pythonutils.html A python resource page with various python modules available. **NEW** dataenc.py This is a set of functions that provide a binary to ASCII encoding (based on a user definable TABLE) and binary interleaving which can be used for combining files or time/datestamping data. The purpose of this is that an encrypted password can be timestamped and then included as ASCII in a hidden form field - in the HTML output of a CGI. This gives a convenient way of providing a 'user login' with a CGI - but the password (or it's SHA hash) that is hidden in the HTML is 'time stamped' so that even if is extracted from the HTML it can't be used once it has expired. Conceivably, the binary interweave functions could be used for combining, 'watermarking' or timestamping any data. The binary to ascii function is no 'better' than the binascii module - but the mapping is user definable. It can be used for storing *any* binary data as ascii - e.g. an SHA hash in a ConfigObj ! Other Modules on this Page : ConfigObj 2 - simple config file parser that behaves like a dictionary. listparser - parses strings into lists (including nested lists) dateutils - a set of functions for handling and working out dates csv_s - a very simple module for reading/writing/comparing CSV files. Nanagram - not really a module, a Tkinter desktop application for finding anagrams. Make silly anagrams of your friends names ! Great fun. Also available as a CGI for including on your own website. Guestbook - again, not really a module. The Voidspace Python Guestbook. Uses HTML templates for simple integration into your own site. ConfigObj 2 ConfigObj is a lightweight and easy to use config file parser. It allows you and your users to write simple text config files - and for you to easily load, parse, change and save them. In practise, you hand ConfigObj a filename and it parses the values from keywords in the file. For adding, retreiving or changing values/keywords it then behaves liek a normal python dictionary. You can then write the edited data back to file if you need to with a simple configobj.write() command. You can give it a list of keywords to parse - or simply have it find all the keywords in the file. Comments inline with keywords are preserved. listparser Not only this, but each value can either be a single value *or* a list of values. This now includes lists of lists !! In other words each element of a list, can itself be a list. This is implemented using listparser - a simple module with functions for reading lists from a string and also turning lists back into strings. A useful way of storing data in a readable format. This module is available seperately if you want but included in the configobj2 zip. Dateutils This is a set of functions for dealing with dates - written for a little tool called 'Victory Days'. They are particularly useful for dealing with appointments - e.g. the second Tuesday in March etc... The functions will tell you what day of the week a date is, work out the 'Julian day number' of a date is, correctly add numbers of days (weeks, months etc) to a date and tell you the number of days between a date, format a datestring etc. Full correction for leap years and much more. csv_s A very simple module for reading/writing/comparing CSVs. For use where you have a version of python prior to 2.3 or don't need hte compelxity of the CSV module. Also a couple of other goodies that maybe of interest - particularly for new programmers. For a comprehensive set of python links see - YAPLP (yet anothe python links page) : http://www.voidspace.org.uk/coollinks/python_links.shtml Regards, Fuzzyman fuzzyman AT voidspace DOT org DOT uk
participants (1)
-
fuzzyman@voidspace.org.uk