I have to take the values from a text file which contains the co-ordinates to draw characters out in TurtleWorld, an example of the text file is the following:
<character=B, width=21, code=66>
4 21
4 0
-1 -1
4 21
13 21
16 20
17 19
18 17
18 15
17 13
16 12
13 11
-1 -1
4 11
13 11
16 10
17 9
18 7
18 4
17 2
16 1
13 0
4 0
</character>
I have to then write a function to take all of these points and then convert them into a dictionary where a key is the character and the corresponding values are the set of points which can be used to draw that character in TurtleWorld.
The code I have tried is the following:
def read_font():
    """
    Read the text from font.txt and convert the lines into instructions for how to plot specific characters
    """
    filename = raw_input("\n\nInsert a file path to read the text of that file (or press any letter to use the default font.txt): ")
    if len(filename) == 1:
        filename = 'E:\words.txt'
        words =  open(filename, 'r')
    else:
        words =  open(filename, 'r')
    while True:                                                                                 # Restarts the function if the file path is invalid
        line = words.readline()
        line = line.strip()
        if line[0] == '#' or line[0] == ' ':                                                    # Used to omit the any unwanted lines of text
            continue
        elif line[0] == '<' and line[1] == '/':                                                 # Conditional used for the end of each character
            font_dictionary[character] = numbers_list
        elif line[0] == '<' and line[1] != '/':                             
 
     
     
    