简体   繁体   English

Python - 单击打开浏览器

[英]Python - Open browser with click

I am currently uploading a file and opening it's content on a website with我目前正在上传文件并在网站上打开它的内容

click.launch('http://example.com/fileThatIUploaded.php')

I want to delete the file once the user closes the browser window though.我想在用户关闭浏览器窗口后删除该文件。

Can someone please help with how this trigger is utilized?有人可以帮助说明如何使用此触发器吗?

I'm using click module.我正在使用click模块。

Checking the docs:检查文档:

http://click.pocoo.org/5/api/#click.launch http://click.pocoo.org/5/api/#click.launch

click.launch() accepts a "wait" argument. click.launch() 接受“等待”参数。 Therefore, you could do因此,你可以做

click.launch(' http://example.com/fileThatIUploaded.php ', wait=True) click.launch(' http://example.com/fileThatIUploaded.php ', wait=True)

And delete the file when it returns.并在文件返回时删除该文件。 If you need to do other stuff while it's happening, do this in a thread.如果您需要在它发生时做其他事情,请在线程中执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM