Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hdhanani

macrumors member
Original poster
Sep 15, 2007
86
0
Vancouver, BC
Hey everyone! I was wondering what you can do with the python runtime environment app once it's installed. Is there any way to write programs.

Your answers will be appreciated! Thanks
 

kinchee87

macrumors 6502
Jan 9, 2007
289
211
New Zealand
You can right your own programs/scripts and then transfer them to your iPod Touch via SFTP. Then go to the terminal and run the programs/scripts.

Here's an extremely simple python program:
Code:
# A hello world python programme that will echo your inputs
#
# kinchee87
# 21 October 2007


print "#======================================#"
print "# Hello World                          #"
print "# Commandline echoer                   #"
print "#                            kinchee87 #"
print "#                      20 October 2007 #"
print "#======================================#"
print

from time import gmtime, strftime	# For reading in date
import sys				# For taking in commandline arguments

def main():
	print "The time is: ", strftime("%a, %d %b %Y %H:%M:%S", gmtime())
	print "Type 'exit' to end python programme"
	print
	
	inputTimes = 0
	
	while True:
		inputTimes = inputTimes + 1
		string = raw_input("Input %(times)d: " %{'times': inputTimes})
		
		if (string == 'exit'):
			break
			
		print "Your input was: ", string
		print

main()
print
print "*End of programme*"
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.