运行下载链接,然后用一个存储变量的URL将python的文件夹解开到python的文件夹
如何制作Python中的脚本,该脚本通过用户通过输入中的控制台输入的值替换在存储库的特定URL中,以便能够下载.zip并自动下载时(文件夹)是在输入并打开包装的地方创建的,例如:
给定两个随机的github url:
https://github.com/exercism/python/archive/refs/heads/bobahop-patch-1.zip-1.zip
用户可以通过控制台输入“ patch-1”或“ patch-2”,并且该值将在URL中替换,然后将执行链接,并将其包含的.zip下载到存储库中。同时,将创建一个带有任何名称的文件夹(例如,用户在控制台中输入的值),并且下载的.zip将移至该文件夹,一旦那里进行解压缩。
How could a script in python be made that, through a value entered by the user through the console in an input, is replaced in a specific url of a repository to be able to download a .zip and when it is downloaded automatically, a folder is created where it is entered and would unpack, for example:
Given two random github urls:
https://github.com/exercism/python/archive/refs/heads/bobahop-patch-1.zip
https://github.com/exercism/python/archive/refs/heads/bobahop-patch-2.zip
The user could enter "patch-1" or "patch-2" by console and this value would be replaced in the url and in turn the link would be executed and the .zip it contains would be downloaded to the repository. Simultaneously, a folder with any name would be created (the value entered by the user in the console, for example) and the downloaded .zip would be moved to that folder and once there it would be decompressed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Python具有
urllib
从网页获取/下载数据urllib.request.urlretrieve()
os
创建文件夹os.makedirs()
并移动/重命名文件os.rename()
zipfile
compress/uncompress.zip
file filePython has
urllib
to get/download data from web pageurllib.request.urlretrieve()
os
to create folderos.makedirs()
and move/rename fileos.rename()
zipfile
to compress/uncompress.zip
file