[Tutor] Translating to Python

Israel Evans israel@lith.com
Mon, 1 Jul 2002 14:11:30 -0700

Eyes.. Blurring...

Mind filled with $ %# c  ... unbearable stuff...

<passed out on the floor>

ps.  Sorry I can't help you, but I feel your pain.


-----Original Message-----
From: Kyle Babich [mailto:kb@kb5.org] 
Sent: 01 July 2002 2:08 PM
To: tutor
Subject: [Tutor] Translating to Python

Could someone show me how to translate this to python from perl?

#!/usr/bin/perl -wT
use strict;
use CGI qw/ :standard /;

print header ( 'text/html' );

my $c = param('c');
my $content = "c";
	if ($c eq "abc") {
		$content = qq{abc123};
	} elsif ($c eq "def") {
		$content = qq{def456};
	} else {
		print "error:  content failed\n";

open(TEXT,"text.txt") or die ("error:  text.txt failed\n");
	my $text = <TEXT>;
close(TEXT) or die("error:  close text.txt failed\n");

print <<"EndOfHTML";





And/or could someone recomend a good python tutorial from the ground up
that includes opening external files and if/elseif statements?

Thank you in advance,

Tutor maillist  -  Tutor@python.org