作者zero06795 (zero06795)
看板Python
标题[问题] Python 子程序内变数提取至主程序问题
时间Sun Mar 24 00:40:30 2019
各位大佬们请帮帮新手小白~我想了好久了 先谢谢大家了
请问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://webptt.com/cn.aspx?n=bbs/Python/M.1553359232.A.F6F.html
3F:→ sating00: eturn-multiple-values-from-a-function03/24 09:04
5F:→ zero06795: 感觉用return是没错的,但我if 句尾加上return 主程序03/25 08:18
6F:→ zero06795: 一样ros值是错的= =“03/25 08:18
※ 编辑: zero06795 (118.171.230.146), 03/26/2019 08:25:02