Modify values to concatenate binary text data

Question:

This topic is basically based on concatenation (of iterable data) or another such data type as list. In order to make printable representation, built-in repr returns an array object strong text containing single quotes next to opposite quotes, then, contain some method associated with repr or the method used by a previous statement such as join for the next expression map(lambda x: repr("".join(list(' '*10))), range(12)) and then use as a parameter in the list() method, like the following example.

Could you remove the quote characters that are only located at indices in the index range [-2:] [2:]?

# example number N for range
map(lambda x: repr("".join(list(' '*10))), range(12))
>>> <map object at 0x00000240540F4640>
list(map(lambda x: repr("".join(list(' '*10))), range(12)))
["'          '", "'          '", "'          '", 
 "'          '", "'          '", "'          '",
 "'          '", "'          '", "'          '",
 "'          '", "'          '", "'          '"]
Asked By: user11717481

||

Answers:

you can modify

map(lambda x: repr("".join(list(' '*10))), range(12))

to this

map(lambda x: repr("".join(list(' '*10)))[2:-2], range(12))

here is full code

>>> k = map(lambda x: repr("".join(list(' '*10)))[2:-2], range(12))
>>> list(k)
['        ', '        ', '        ', '        ', '        ', '        ', '        ', '        ', '        ', '        ', '        ', '        ']
Answered By: sahasrara62
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.