python - Converting a list of Strings into one single integer -


i have list one:

 ["1", "8", "9", "5", "6"] 

and want convert single integer. desired output this: 18956

is there elegant method this?

the way coming mind going through list , multiplying digit needed power of ten , adding up. sure there better method, not it? help.

this want:

it joins each digit single string using '' (an empty string) separator, yielding '18956'.

it converts string integer using int() factory function:

int(''.join(["1", "8", "9", "5", "6"])) 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -