To create a .py script using IDLE
Start IDLE in Ubuntu, click Application -> Programming -> IDLE (using Python-3.1)
Click File -> New Window
A new window will be open, you can type your Python script here.
Then, you can save (File->Save or File->Save As) it as .py script file, or run it in Python Shell (Run->Run Moduel).