In order to create a mini project for a game I am developing a function which should returns one row of a board (in the words game) per line with newlines not included in the board by opening and reading a file.
But instead of calling the file I just try that python read it avoiding using the open file method. So what I tried firstly was create a loop for this function but something must be wrong cause an error message appears when I test this function.
'list' object has no attribute 'split'
Could you help me with this function. My current progress is this but I am a bit stuck at this point cause I don't know what could be wrong at all.
def read_board(board_file):
"""
(file open for reading) -> list of list of str
"""
board_list_of_lists = []
for line in board_file:
board_list_of_lists = board_list_of_lists.split('\n')
return board_list_of_lists