Fri Nov 04, 2011 5:38 am by Joe Batt
Hi all I am new to here and to programming as well so please feel free to comment on my code
I have a solution but I don't know how to get to the next URL using it….can anyone help please….
My code is
###########################################################################
# Python Challenge 2 --- http://www.pythonchallenge.com/pc/def/ocr.html
# Program to find unique characters in a source file in .txt format on desktop
# and write the unique characters back to new file
# Author: Joe Batt 4 Nov 2011
###########################################################################
textFileDecode=open('///Users/joebatt/Desktop/messdecode.txt','a+') #opens file for storing decode
textFile=open('///Users/joebatt/Desktop/mess.txt','r') #opens file holding source code needing decode
contents=textFile.read() #contents holds source code needing decode
fileSize=len(contents) #Get length of file to detirmine size of contents to be sorted
filePosit=0 #defime start position in file to get character to be checked from
while filePosit<=fileSize-1: #<----loop back to here to check next character
char=(contents[filePosit]) #Gets 'char' the individual character to check
# IF ELSE checks if the 'char' is in the 'contents' file
if contents.count(char,0,fileSize)>1: #if 'char' is in the file more than 1 time it is not unique
filePosit+=1
else: #'char' is NOT in the file
textFileDecode.write(str(char))
filePosit+=1
else:
textFile.close() #closes source code file
textFileDecode.close()#closes decoded file
#Prints the file with the decoded text
textFileDecode=open('///Users/joebatt/Desktop/messdecode.txt','r')
contents=textFileDecode.read() #contents holds decoded file
print ("The decode is : "+contents)
textFileDecode.close()
input("Please press 'ENTER' to quit")