我试图制作一个脚本来下载一个文件(在本例中是python文件)。然后将该文件重命名为所述文件第一行中包含的任何内容。这些文件在gui文件系统中似乎命名正确,但终端显示它们实际上是用.py命名的?扩展而不是.py。问题是,是吗“python”时不执行文件文件.py?' 已输入。下面是伪代码的大致情况:
curl fileurl.com -o temp #Downloads file to working directory with name 'temp'
file_name = getFirstLineOf(temp) #Returns the first line of the file to variable 'file_name'
runInTerminal('mv temp '+file_name) #renames file 'temp' as 'file_name'
越来越具体。。。你知道吗
file_name = 'aFile.py' #assume name came from first line of said file
runInTerminal('mv temp '+file_name)
…导致文件名为'aFile.py?' 而不是'文件.py'
目前没有回答
相关问题 更多 >
编程相关推荐