def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    return urllib2.urlopen(codeskulptor.file2url(filename))
Example #2
0
def load_words(filename):
    """
    Load word list from the file named filename.
    Returns a list of strings.
    """
    net_file = urllib2.urlopen(codeskulptor.file2url(filename))
    return net_file.read().split('\n')
Example #3
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """ 
    data = urllib2.urlopen(codeskulptor.file2url(filename))
    return [line[:-1] for line in data.readlines()]
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    a_file = urllib2.urlopen(codeskulptor.file2url(filename))
    return list(a_file.readlines())
Example #5
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    a_file = urllib2.urlopen(codeskulptor.file2url(filename))
    return list(a_file.readlines())
Example #6
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    online_file = urllib2.urlopen(url)
    return [word[:-1] for word in online_file]
def load_words(filename):
    
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    words_file = netfile.readlines()
    
    words = [word[:-2] for word in words_file]
    
    return words
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    online_file = urllib2.urlopen(url)
    return [word[:-1] for word in online_file]
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url=codeskulptor.file2url(filename)
    netfile=urllib2.urlopen(url)
    return netfile.read()
Example #10
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(WORDFILE)
    netfile = urllib2.urlopen(url)
    return [line[:-1] for line in netfile.readlines()]
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    myfile = urllib2.urlopen(codeskulptor.file2url(filename)).read()
    mywords = myfile.split("\n")
    return mywords
Example #12
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    given_file = urllib2.urlopen(url)
    return given_file
Example #13
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    :param filename:
    """
    file_url = urllib2.urlopen(codeskulptor.file2url(filename))
    return [word.rstrip() for word in file_url]
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    data = netfile.read()
    return data
Example #15
0
def count_distinct_words(filename):
    """
    This function returns a count of the number of distinct words 
    that occur in the provided text file.
    """
    data = urllib2.urlopen(codeskulptor.file2url(filename))
    text = data.read()
    newtext = "".join(char for char in text
                      if char not in "!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~")
    return len(set(re.findall('\w+', newtext.lower())))
Example #16
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    datafile = urllib2.urlopen(codeskulptor.file2url(filename))
    data = datafile.read()
    result = data.split()
    return result
Example #17
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    datafile = urllib2.urlopen(codeskulptor.file2url(filename))
    data = datafile.read()
    result = data.split()
    return result
Example #18
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    dict_file = urllib2.urlopen(codeskulptor.file2url(filename))
    ans = []
    for item in dict_file.readlines():
        ans.append(item[:-1])
    return ans
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    FILENAME = "assets_scrabble_words3.txt"
    url = codeskulptor.file2url(FILENAME)
    netfile = urllib2.urlopen(url)
    dictionary = [line[:-1] for line in netfile.readlines()]      
    return dictionary
Example #20
0
def load_words(filename):
    '''
    Load word list from the file named filename.
    Returns a list of strings.
    '''
    words = []
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    for line in netfile.readlines():
        words.append(line[:-1])
    return words
Example #21
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    netfile = urllib2.urlopen(codeskulptor.file2url(filename))
    list_words = []
    for word in netfile.readlines():
        list_words.append(word)
    return list_words
Example #22
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    words = []
    url = codeskulptor.file2url(WORDFILE)
    dic = urllib2.urlopen(url)
    words = [word[:-1] for word in dic.readlines()]
    return words
Example #23
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    netfile = urllib2.urlopen(codeskulptor.file2url(filename))
    list_words = []
    for word in netfile.readlines():
        list_words.append(word)
    return list_words
Example #24
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    words = []
    url = codeskulptor.file2url(WORDFILE)
    dic = urllib2.urlopen(url)
    words = [word[:-1] for word in dic.readlines()] 
    return words
Example #25
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    data = netfile.readlines()
    words_dict = [line[:-1] for line in data]
    return words_dict
Example #26
0
def load_words(filename):
    """
    Load word list from the file named filename.
    Returns a list of strings.
    """
    words = []
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    for line in netfile.readlines():
        words.append(line)
    return words
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    file1 = urllib2.urlopen(codeskulptor.file2url(filename))
    result = list()
    for line in file1.readlines():
        result.append(line[:-1])
    return result
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    dictionary_file = urllib2.urlopen(codeskulptor.file2url(filename))
    word_list = []
    for line in dictionary_file.readlines():
        word_list.append(line[:-1])
    return word_list
Example #29
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url("assets_scrabble_words3.txt")
    word_lst = urllib2.urlopen(url)
    result = []
    for word in word_lst.readlines():
        result.append(word[:-1])
    return result
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename) # only useful for codeskulptor
    netfile = urllib2.urlopen(url)
    data = []
    for item in netfile.readlines():
        data.append(item[:-1])
    return data
Example #31
0
def load_words(filename):
    """ Load word list from the file named filename. Returns a list of strings. """
    url = codeskulptor.file2url(
        WORDFILE
    )  # this is just a feature of the CODESCULPTOR of creating an url: 'http://codeskulptor-examples.commondatastorage.googleapis.com/examples_files_dracula.txt' in this case
    netfile = urllib2.urlopen(
        url)  # this will download the file from the internet
    # netfile = open(WORDFILE, "r+")  # this reads the file from the hard drive
    words = [
        word[:-1] for word in netfile.readlines()
    ]  # this is for Python2, 'word[:-1]' is for removing CrLf at the end
    return words
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    dict_file = urllib2.urlopen(url)
    result = []
    for each_line in dict_file.readlines():
        result.append(each_line[:-1])
    return result
Example #33
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    word_list = []
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    for item in netfile.readlines():
        word_list.append(item)
    return word_list
Example #34
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    strings = []
    url = codeskulptor.file2url(filename)
    content = urllib2.urlopen(url)
    for line in content.readlines():
        strings.append(line[:-1])
    return strings
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    words_file = netfile.readlines()
    words = [word[:-2] for word in words_file]

    return words
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    doc = urllib2.urlopen(url)
    words = []
    for line in doc.readlines():
        words.append(line[:-1])
    return words
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    result = []
    url = codeskulptor.file2url(WORDFILE)
    netfile = urllib2.urlopen(url)
    for line in netfile.readlines():
        result.append(line)
    return result
Example #38
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    word_list = []
    words = codeskulptor.file2url(WORDFILE)
    netfile = urllib2.urlopen(words)
    for line in netfile.readlines():
        word_list.append(line[:-1])
    return word_list
Example #39
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    data_string = netfile.read()
    word_list = data_string.split()
    
    return word_list
Example #40
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url("assets_scrabble_words3.txt")
    word_lst = urllib2.urlopen(url)
    result = []
    for word in word_lst.readlines():
        result.append(word[:-1])
    return result
Example #41
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    ans = []
    file_url = codeskulptor.file2url(WORDFILE)
    the_file = urllib2.urlopen(file_url)
    for line in the_file.readlines():
        ans.append(line)
    return ans
Example #42
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    str_list = []
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    for word in netfile.readlines():
        str_list.append(word.strip())
    return str_list
Example #43
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    dictionary = []
    for line in netfile.readlines():
        dictionary.append(line[0:-1])
    return dictionary
Example #44
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    data = []
    for line in netfile.readlines():
        data.append(str(line))
    return data
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    string_lists = []
    for line in netfile.readlines():
        string_lists.append(line[:-1])
    return string_lists
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(WORDFILE )
    netfile = urllib2.urlopen(url)
    string_list = []
    for word in netfile.readlines():
        string_list.append(word)
    return string_list
Example #47
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    result = []
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    data = netfile.readlines()
    for line in data:
        result.append(line[:-1])
    return result
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    _url = codeskulptor.file2url(filename)
    _netfile = urllib2.urlopen(_url)
    
    _data = _netfile.read()
    _words = _data.split("\n")
    
    return _words
def load_words(filename):
    """
    Load word list from the file named filename.
    Returns a list of strings.
    """
    url = codeskulptor.file2url(WORDFILE)
    netfile = urllib2.urlopen(url)

    word_list = []
    for word in netfile.readlines():
        word = word[:-1]
        word_list.append(word)
    #print word_list
    return word_list
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    #print url
    netfile = urllib2.urlopen(url)
    lines = []
    for line in netfile.readlines():
        lines.append(line[:-1])
    #print lines
    return lines
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    
    words = []
    for line in netfile.readlines():
        words.append(line.replace('\n',''))
    
    return words
Example #52
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    data = netfile.readlines()

    for index in range(len(data)):
        data[index] = data[:-1]

    return data
Example #53
0
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """

    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(
        "http://codeskulptor-assets.commondatastorage.googleapis.com/assets_scrabble_words3.txt")
    words_file = netfile.readlines()

    words = [word[:-2] for word in words_file]

    return words
Example #54
0
 def __init__(self, game):
     self._game = game
     url = codeskulptor.file2url(IMAGENAME)
     self._tiles = simplegui.load_image(url)
     self._directions = {"up": UP, "down": DOWN, "left": LEFT, "right": RIGHT}
     self._rows = game.get_grid_height()
     self._cols = game.get_grid_width()
     self._frame = simplegui.create_frame(
         "2048", self._cols * TILE_SIZE + 2 * BORDER_SIZE, self._rows * TILE_SIZE + 2 * BORDER_SIZE
     )
     self._frame.add_button("New Game", self.start)
     self._frame.set_keydown_handler(self.keydown)
     self._frame.set_draw_handler(self.draw)
     self._frame.set_canvas_background("#A39480")
     self._frame.start()
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    
    data = []
    for line in netfile.readlines():
        word = line.strip()
        data.append(word)
    
    return data
Example #56
0
 def __init__(self, game):
     self._game = game
     url = codeskulptor.file2url(IMAGENAME)
     self._tiles = simplegui.load_image(url)
     self._directions = {"up": UP, "down": DOWN,
                         "left": LEFT, "right": RIGHT}
     self._rows = game.get_grid_height()
     self._cols = game.get_grid_width()
     self._frame = simplegui.create_frame('2048',
                     self._cols * TILE_SIZE + 2 * BORDER_SIZE,
                     self._rows * TILE_SIZE + 2 * BORDER_SIZE)
     self._frame.add_button('New Game', self.start)
     self._frame.set_keydown_handler(self.keydown)
     self._frame.set_draw_handler(self.draw)        
     self._frame.set_canvas_background("#A39480")
     self._frame.start()
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    
    # Open the file in the specified URL
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    
    # Read all the words in that file
    words = netfile.read()
    
    # Return the words in a list of words
    return words.split("\n")
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """

    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)

    data = []
    #print data
    #print type(data)

    for line in netfile.readlines():
        data.append(line[:-1])

    #print data
    return data
def load_words(filename):
    """
    Load word list from the file named filename.

    Returns a list of strings.
    """
    strings = []
    
    # Load the url
    url = codeskulptor.file2url(filename)
    netfile = urllib2.urlopen(url)
    huge_strings = netfile.read()
    
    # Reiterates through the strings and store each words
    # into a list everytime it sees a newline
    temp_string = ''
    for dummy_strings in huge_strings:
        if dummy_strings == '\n':
            strings += [temp_string]
            temp_string = ''
        else:
            temp_string += dummy_strings
    
    return strings