Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Convert '165.0' to int
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="SigmundV, post: 4231168"] I'd say that we have established that there is no shortcut, no built- in for this. You write you own function: string_to_int = lambda s: int(float(s)) Then you apply it to your list of strings: list_of_integers = map(string_to_int, list_of_strings) Of course, this will be horribly slow if you have thousands of strings. In such a case you should use an iterator (assuming you use python 2.7): import itertools as it iterator = it.imap(string_to_int, list_of_strings) Regards, Sigmund [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Convert '165.0' to int
Top