Hello.
I have a list:

mylist = [2,4,4]

How can i take number 244 out from the list? Something like:

number = 244

Here 244 is integer.

Something like this ...

mylist = [2,4,4]
number = int("".join(str(n) for n in mylist))
print(number, type(number))

This is very similar to your previous question. Take the time to understand how the code works

number = int(''.join(mylist))

Edited 1 Year Ago by Gribouillis

Thank you @vegaseat.
Could you make more clrear this line for me please?

number = int("".join(str(n) for n in mylist))

int means return ( ) into integer.
"".join means add no-space to the ( ).
I can't understand this completely str(n) for n in mylist, what does it exactly do?

-------------------------------------
@Gribouillis, with this:

mylist = [6, '/', 3, '+', 9, '+', 8, '+', 1, '/', 2]
number = int(''.join(mylist))
print number

I got this error:

    number = int(''.join(mylist))
TypeError: sequence item 0: expected string, int found

with this:

mylist = [2,4,4]
number = int(''.join(mylist))
print number

I got this error:

    number = int(''.join(mylist))
TypeError: sequence item 0: expected string, int found
This question has already been answered. Start a new discussion instead.