Python runtime app

Discussion in 'iPod touch Hacks' started by hdhanani, Oct 28, 2007.

  1. hdhanani macrumors member

    Joined:
    Sep 15, 2007
    Location:
    Vancouver, BC
    #1
    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
     
  2. kinchee87 macrumors regular

    kinchee87

    Joined:
    Jan 9, 2007
    Location:
    New Zealand
    #2
    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*"
    
     

Share This Page