功能不会参与

Mik*_*ika 0 python

下面是检查网站价格并将其发送到Twitter的代码.正如您所看到的,在第22行,我将第一个函数(获取价格)作为参数传递给第二个函数(流向Twitter).当我运行它时,我不断收到一条错误消息,指出"TypeError:send_to_twitter()不带参数(给定1个)".无法弄清楚为什么它不会参与争论.任何的想法?

import urllib.request
import time

def get_price():
    page = urllib.request.urlopen("http://www.beans-r-us.biz/prices.html")#get price from website
    text = page.read().decode("utf8")
    where = text.find('>$')
    start_of_price = where + 2
    end_of_price = start_of_price + 4
    return float(text[start_of_price:end_of_price])


def send_to_twitter():
    password_manager = urllib.request.HTTPPasswordMgr()
    password_manager.add_password('Twitter API','http://twitter.com/statuses','eyemademusic','selfishgene')
    http_handler = urllib.request.HTTPBasicAuthHandler(password_manager)
    page_opener = urllib.request.build_opener(http_handler)
    urllib.request.install_opener(page_opener)
    params = urllib.parse.urlencode({'status':msg})
    resp = urllib.request.urlopen('http://twitter.com/statuses/update.json', params)
    resp.read

price_now = input('Would you like to check the price? Y/N')
if price_now == 'Y':
    send_to_twitter(get_price())
else:
    price = 99.99
    while price > 4.74: 
        time.sleep(900)
        price = get_price   
    send_to_twitter('Buy!')
Run Code Online (Sandbox Code Playgroud)

JBe*_*rdo 5

def send_to_twitter(name_of_the_argument_you_want):
Run Code Online (Sandbox Code Playgroud)