Answer the question
In order to leave comments, you need to log in
How to truncate the characters in the list in each element: [' ']?
How to truncate the characters in the list in each element: [' ']
I need to get a list, but without extra elements .
Print should print only a list of words without parentheses or quotes.
There is a list:
[['Курица'] , ['Масло'], [' Гречка'], ['Молоко'], ['Мясо'], ['Рыба'], ['Хлеб'] ]
Answer the question
In order to leave comments, you need to log in
And what for the list with lists from one element?
what separator, ksati?
x = [['Курица'] , ['Масло'], [' Гречка'], ['Молоко'], ['Мясо'], ['Рыба'], ['Хлеб']]
for i in x:
print(i[0], end=' ')
print()
new_list = []
for i in x:
new_list.append(i[0])
print(" ".join(new_list))
print(" ".join(i[0] for i in x))
ln = len(x)
stroke = ""
for i, j in enumerate(x):
stroke += j[0]
if i < ln:
stroke += " "
print(stroke)
Print should print only a list of words without parentheses or quotes.
my_list = [['Курица'] , ['Масло'], ['Гречка'], ['Молоко'], ['Мясо'], ['Рыба'], ['Хлеб'] ]
for l in my_list:
print(l[0],end=' ')
>>> Курица Масло Гречка Молоко Мясо Рыба Хлеб
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question