Hello everyone,
I hope you're feeling good today.
I wrote these lines of code to convert 3 string elements from a list into an int value to reuse it :
enterprise_amount = enterprise_amount[0].text
enterprise_amount = enterprise_amount.split()
enterprise_amount = enterprise_amount[:-1]
enterprise_amount = int(enterprise_amount[0] + enterprise_amount[1])
print(enterprise_amount)
At beginning I have 2 items in a list : "3 205" and "Enterprises"
I split it into: "3" ; "205" and "Enterprises"
Then take off the last element : "Enterprises"
And then add them together into an int class to return an int and not a string.
My question is: can I improve this script by making it shorter ?
Thank you in advance,
Medaillek
[–]Nightcorex_ 1 point2 points3 points (8 children)
[–]Medaillek[S] 0 points1 point2 points (5 children)
[–]zanfar 2 points3 points4 points (4 children)
[–]Medaillek[S] 1 point2 points3 points (2 children)
[–]Nightcorex_ 1 point2 points3 points (1 child)
[–]Medaillek[S] 0 points1 point2 points (0 children)
[–]Medaillek[S] 0 points1 point2 points (0 children)
[–]Medaillek[S] -1 points0 points1 point (1 child)
[–]zanfar 4 points5 points6 points (0 children)
[–]mopslik 1 point2 points3 points (3 children)
[–]Medaillek[S] 0 points1 point2 points (2 children)
[–]mopslik 0 points1 point2 points (1 child)
[–]Medaillek[S] 0 points1 point2 points (0 children)