-2

I have this tuple: (1, 0, 0, 2)

and i want a string like: 0 0 2 (without the first number)

how can I do this?

linaki865
  • 61
  • 3

2 Answers2

-1
your_tuple = (1, 0, 0, 2)
result = ' '.join([str(v) for v in your_tuple[1:]])

An array of elements in the tuple excluding the first element is created and then joined by a space. The array should have string elements. Hence str(v) is to be applied.

Pardhu
  • 5,618
  • 2
  • 12
  • 23
Aramakus
  • 1,403
  • 2
  • 8
  • 19
-1

You can do this:

your_tuple = (1, 0, 0, 2)
your_string = ' '.join(map(str, your_tuple[1:]))