Filtered by Python

Page 29

Reset

Python UnZipped

March 11, 2004
0 comments Python

Zipping and unzipping a file in Python is child-play. It can't get much easier than this. Well, in Windows you can highlight a couple of files and right-click and select from the WinZip menu. Here's how to do it in Python:


>>> import zipfile
>>> zip = zipfile.ZipFile('Python.zip', 'w')
>>> zip.write('file1.txt')
>>> zip.write('file2.gif')
>>> zip.close()

Still confused? Read this article for "Dev Shed"n:http://www.devshed.com/ then. The article includes some more advanced uses as well.

PSP - Python Server Pages

March 9, 2004
2 comments Python

"Python Server Pages (PSP), as you probably guessed already, is a way to inline Python in HTML or XML documents. The server interprets this inlined code to produce the final HTML sent to the client. This approach has become popular with tools such as JSP, PHP, and ColdFusion."

I really hope this catches on. It'll be the perfect alternative to PHP. PHP is very popular because it's easy to use but the syntax and execution is poor compared to Python. I guess PHP will stay strong for quite some time still but if PSP can get the tight Apache and MySQL integration that PHP has, we have a winner here.

Recon - Regular Expression Test Console

January 14, 2004
0 comments Python

This is a fantastic little Python GUI using Tkinter, for testing your regular expressions in Python. You first paste or write in some text, then you doodle some regular expressions to see the outcome. What I do miss is exporting of actual code. Usually when I write my regular expression I fire up the interactive shell from which I can copy code when I'm happy with it. Like this:


>>> import re
>>> e=re.compile(r'\?q=(.*?)&', re.I)
>>> print e.findall("http://www.google.com.br/search?q=paper+plane&hl=pt-BR")
['paper+plane']

From silly code like that I can actually copy and paste the actual syntax. Ah well, I still like this Recon thing.

PythonPoint

January 10, 2004
0 comments Python

PythonPoint PythonPoint is a piece open source software that converts XML to PDFs that looks like presentation slides.

"Essentially, it converts slides in an XML format to PDF."

Here's a 270Kb sample PDF document.

Case study where Python was the final choice

December 3, 2003
0 comments Python

This is an article about a group of developers who had a task to do but hadn't chosen what programming language to use. The alternatives they had to choose from were C, PHP, Perl, Java and Python; and the requirements where these:

  • We planned to prototype on a remote device and anticipated numerous changes. We needed a language that was designed with change in mind.
  • We wanted to avoid the added step of code compilation in order to minimize the overhead associated with a change. An interpreted language seemed pragmatic.
  • We wanted a language with good introspection capability.
  • We needed to do a lot of string manipulation and file I/O. Whatever language we chose had to excel in both of these areas.

It's so suited for Python that it almost sounds as if they wrote the requirements after the choice. But that's just how Python is.

Py2TeX

November 29, 2003
0 comments Python

Py2TeX
This is a module worth remembering. It converts Python code into TeX nicely. Unfortunately not colour coded, but "=" equal signs become "<--" arrows and negations like "!=" become an equal sign with a dash across it. This will be good for formatting little sections of Python code into serious documentation.

Zolera SOAP Infrastructure 1.4

November 14, 2003
1 comment Python

Nice! Now there's a decent Python SOAP module that I need to find time to explore. I want to set up some web services on my site that can be interfaced in different ways on other servers/clients. Just need to think of something that can be useful.

Any ideas anyone?

(more links on pywebsvcs.sourceforge.net)

Parrot; CLR for the poor man

November 6, 2003
0 comments Python

I really like the CLR idea that is used in Microsoft .NET

A CLR lets you run programs as a mix of programs written in several different languages. Zope is another such framework. You can use either Python, Perl or PHP for scripting; but that's a much higher level and with a different goal.

The story of Parrot is funny. It started as a April's fool joke, but was later taken seriously and is now a serious open source project.

"Parrot is now the name of a proposed virtual machine that should be able to run Perl as well as Python code." Read more here

This article describes it better.

Previous page
Next page