1

How can a numpy array like this:

[1, 2, 37, 0]

be converted to a single int number like this:

01023700

In https://stackoverflow.com/a/65293222/1139541 'blacksite' solved a similar problem but in the problem presented above, every number should be presented with 2 digits.

1 Answer 1

1

Let's try format string (available from Python 3.6):

arr =[1, 2, 37, 0]
''.join(f'{x:02d}' for x in arr)

# '01023700'
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.