第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

我想用 self 參數(shù)線程化一個(gè)函數(shù)

我想用 self 參數(shù)線程化一個(gè)函數(shù)

紫衣仙女 2022-10-06 19:58:42
我想線程化這個(gè)函數(shù),但不知道當(dāng) self 參數(shù)到位時(shí)如何線程化。任何人都知道我該怎么做。我將不勝感激這是功能def processinformation(self):    app = App.get_running_app()    session = requests.Session()    self.notif_stream = session.get("**********************************" + app.displayname + "/.json", stream=True)    for line in self.notif_stream.iter_lines():        if line:            print(json.loads(line))            newline = ast.literal_eval(line.decode('utf-8'))            for key, thevalue in newline.items():                for key, value in thevalue.items():                    self.notif = session.get("**********************************" + app.displayname + "/" + key + "/" + "notification" + "/.json")                                              self.notificationslist.adapter.data.extend([value])   
查看完整描述

1 回答

?
青春有我

TA貢獻(xiàn)1784條經(jīng)驗(yàn) 獲得超8個(gè)贊

好的,我通常沒有太多理由編寫多線程 Python 程序,但這似乎可行:


#!/usr/bin/env python3


import threading


class MyTarget:

    def mymethod(self, arg1, arg2):

        print(f"MyTarget, {arg1} {arg2}")


if __name__ == '__main__':

    my_target = MyTarget()

    t = threading.Thread(target=my_target.mymethod, args=("X", "Y"))

    t.start()

    # NOTE: In any _real_ program, the main thread would do

    #  something else, concurrently with the new thread.

    t.join()


查看完整回答
反對 回復(fù) 2022-10-06
  • 1 回答
  • 0 關(guān)注
  • 109 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號