Hello all Python programmers,
I am new to python, although I have read lots and learnt lots considering the amount of time that I have been trying.
I was wondering if it is possible to create a web counter in python. I was just looking through the things like:
Code:
f = open("somefile.txt")
f = write('Some text that this will write')
f = close
and other functions alike.
Is it possible to do something like this PHP code:
Code:
<?php
//Open data
$datafile = file("hits.txt");
// Find out how many hits
$hits = datafile[0];
// Add one
$hits++;
// File handle
$filehandle = fopen("$datafile", 'w');
// Write new hit number
fwrite($filehandle, $hits);
// Save file
fclose($filehandle);
?>
hits.txt
in python.
Any help would be greatly appreciated.
Alex.