K
K
Kto Takoi2021-10-02 23:36:23
Python
Kto Takoi, 2021-10-02 23:36:23

How to work with python list?

look, after parsing, I get something like this
B = ['Something\n','Something there\n']
and using the print command, it displays it in a row like this: 'Something \n','Something there\n' how to make it so that firstly remove the quotes, secondly remove \n this sign and thirdly write everything in a column:
'Something\n'
'Something there \n'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Kuts, 2021-10-02
@Realno_cheal

B = ['Что-то\n','Что-то там\n']

for line in B:
    print(line.replace('\n',''))

# Что-то
# Что-то там

or just
B = ['Что-то\n','Что-то там\n']

print(''.join(B))

# Что-то
# Что-то там

S
Sergey Gornostaev, 2021-10-02
@sergey-gornostaev

print(*B)
PS According to PEP8, variables should not be named in uppercase.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question