Did you know? Programmers convert coffee to code.

If you like my articles, sponsor me a coffee.

First steps in Python

“Gosh we’re all really impressed down here, I can tell you.”

So this should be my first steps on the ground of Python. I will not introduce how the language was created, and what are the usages behind quotes from Monty Python and so. There are many lectures outside in the internet about this topic.

What I’m about to do here is post my developments in Python (console applications, GUI-try-outs, web development), and naturally some load of source code — via gitHub.

How I came to Python? Well it is a longer story: I worked at an IT company back in 2009 where we ported an application between platforms and did an upgrade from BEA WebLogic 8 to Oracle WebLogic 10 (or so), where WLST was the base of the configuration. So I had to learn WLS which is an Oracle-version of Jython which is a Java-like Python. After this project I went back to Plain Old Java Objects and core development and let Python slide away — until recently.

I will use Python 3 where it is possible. I had a look at the version on my paid-website and… yes, I’m disappointed 🙁

So I’ll try to use Python3 conventions where possible, but where not, I’ll list the possibilities for the main Versions (for me these are 3.3, 2.7).

Let’s get started. Our first code will be some lines which results made me feel a bit worried about my website plans:

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
import sys

cgitb.enable()

print "Content-Type: text/plain;charset=utf-8"
print

print(sys.version)

There is no such big deal, the code writes a HTML response and the version of the running Python system. After I set up the file in the right folder (cgi-bin), set the right permissions (+x) it gave the following output:

python_version

As you can see, there is a 2.4.3 Version of Python running. It will be a tough battle to get everything running what I want to do, but I’m positive so it will be OK.

So, for the future I will go step-by-step with easy examples and tutorials for myself and then go on for the more interesting thing (like GUI and Web). So stay tuned, I hope this series will be more active than Variations is ^^

GHajba
 

Senior developer, consultant, author, mentor, apprentice.

I love to share my knowledge and insights what I achieve through my daily work which is not trivial — at least not for me.

Click Here to Leave a Comment Below 0 comments
%d bloggers like this: