Function show() for Canvas.text without displaying "[" and " ' "
Hi,
I am designing an experiment based on the attentional-blink tutorial. The goal is to stream words.
I have a list that contains words.
I used it in a loop (here is a simpler code for illustration purposes).
In the prepare phase :
my_list_subset #a subset of the list that contains words
stimuli_canvas_list = [] #the list used in the trial
for i, stim in enumerate(my_list_subset)
stim_canvas = Canvas()
stim_canvas.text(stim)
stimuli_canvas_list.append(stim_canvas)
And in the run phase :
for words_stimuli in stimuli_canvas_list:
words_stimuli.show()
Everything works fine except that I can't find how to use
words_stimuli.show()
to stream the words without the brackets and the quotation marks (ex : " ['word'] " , but I want "word").
I know that you can use
print(*your_list)
To print list elements without these marks but I don't know if there is something similar to use with :
my_canvas.show()
Any advice would be much appreciate !
Many thanks in advance :)
Comments
Hi @Aurélien ,
Welcome back to the forum! :)
It sounds like you defined my_list_subset as a list of lists, rather than a single list, for example like so:
instead of
Could that be the issue?
If not, could you post your actual code, rather than the simplified version?
Cheers,
Lotje
Did you like my answer? Feel free to

Hi @lvanderlinden ,
Thank you so much ! It solved my problem 😀.
I am not very familiar with Python objects...
In case anyone has the same kind of problem, here is a code that I found at https://stackoverflow.com/questions/952914/how-to-make-a-flat-list-out-of-a-list-of-lists
my_list_subset #list of lists flat_list = [] #the new list for sublist in my_list_subset : #a loop to make a list from the list of lists for item in sublist: flat_list.append(item)