If you are new to using Python on the Raspberry Pi, this article may help you.
First of all, let’s create a simple Python program directly from RPi module, using LeafPad text editor provisioned out of the box with Raspbian operating system.
Therefore, let’s open LeafPad, past the following Python program code snippet:
import datetime dt = datetime.datetime.now() print str(dt)
and save the fine on Desktop with name DateTimeProgram.py
Now open Raspbian terminal LXTerminal and type the following command to reach the Desktop folder:
Next, type the following command to run DateTimeProgram Python program and type Enter key:
The program should now be running and print the dae and time on the output console.