Skip to content

Tag: list

Formatting a list of sentences extracted from text

I am trying to format a list neatly that I have extracted using regex. I would like to have each sentence in its own line and remove the n characters: Image of current output: Answer From OP’s image, text_1 is a list of strings. To remove the newline n characters from a string, you can use the string&#8…

How to use boolean on list correctly?

(result True) I want result become False if only one in list A or B have small value than a or b. In this code B[1] < b[1] (5 >= 10) result I expect is False but is output True Answer From official doc: The comparison uses lexicographical ordering: first the first two items are compared, and if they dif…