看板 Python 關於我們 聯絡資訊
各位大佬們請幫幫新手小白~我想了好久了 先謝謝大家了 請問python主程序運行到觸發副程式(open_file)後,要怎?把副程式變數值提輸出到主程 序 def open_file(): filename = tf.askopenfilename() if filename != '': app=xw.App(visible=False) wb=xw.Book(filename) sht=wb.sheets[0] ros=sht.used_range.rows.count cos=sht.used_range.columns.count print(ros) wb.close() app.quit() else: tkinter.messagebox.showerror(title='error', message='no select') -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.173.71.64 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1553359232.A.F6F.html
sating00: https://i.imgur.com/3lasfN3.png03/24 09:04
sating00: eturn-multiple-values-from-a-function03/24 09:04
sating00: http://bit.ly/2FntNxu 03/24 09:06
zero06795: 感覺用return是沒錯的,但我if 句尾加上return 主程序03/25 08:18
zero06795: 一樣ros值是錯的= =“03/25 08:18
※ 編輯: zero06795 (118.171.230.146), 03/26/2019 08:25:02