$ 符号和计算 python
$ sign and calculation in python
我正在尝试计算一个以 $ 符号表示的值,然后从中减去。不确定具体如何...抱歉,如果是基本问题,但非常感谢。
import urllib.request
from bs4 import BeautifulSoup
import time
urleth = "https://coinmarketcap.com/currencies/ethereum/"
page = urllib.request.urlopen(urleth)
content = page.read().decode('utf-8')
soup = BeautifulSoup(content, 'html.parser')
valeth = soup.find("span", {"id": "quote_price"}).decode_contents(formatter="html")
print("Ethereum price is ", valeth)
print(valeth)
以上为好
以下,不确定。
Valeth 显示 $ 符号,现在确定如何用带美元符号的 $100 减去。
value = (valeth - 0.00)
print(value)
你必须把 100.00 美元赚到 100.00 美元然后,你可以做任何事情。
假设,
var = '0.00'
var = float(var[1:])
value = (valeth - var)
print(value)
我正在尝试计算一个以 $ 符号表示的值,然后从中减去。不确定具体如何...抱歉,如果是基本问题,但非常感谢。
import urllib.request
from bs4 import BeautifulSoup
import time
urleth = "https://coinmarketcap.com/currencies/ethereum/"
page = urllib.request.urlopen(urleth)
content = page.read().decode('utf-8')
soup = BeautifulSoup(content, 'html.parser')
valeth = soup.find("span", {"id": "quote_price"}).decode_contents(formatter="html")
print("Ethereum price is ", valeth)
print(valeth)
以上为好
以下,不确定。 Valeth 显示 $ 符号,现在确定如何用带美元符号的 $100 减去。
value = (valeth - 0.00)
print(value)
你必须把 100.00 美元赚到 100.00 美元然后,你可以做任何事情。 假设,
var = '0.00'
var = float(var[1:])
value = (valeth - var)
print(value)