mercredi 20 juillet 2016

Python remove space from string make it into int

How would I remove the space in <span id="balance">1 268</span> and make it an int

Code:

    Balance_afterWinORLoseBet.replace(" ", "")
    Balance_afterWinORLoseBet = int(balance_new.text) #Makes new var, turns it into int.


if "10.1" in countdown_timer.text: #
    Balance_afterPlaceBet.replace(" ", "")
    Balance_afterPlaceBet = int(balance_old.text) #Makes new var, turns it into int.

Error:

Balance_afterWinORLoseBet = int(balance_new.text) #Makes new var, turns it into int. ValueError: invalid literal for int() with base 10: '1 268'

Aucun commentaire:

Enregistrer un commentaire