MeowSprite
deepin
2016-10-07 04:26 input接收的是字符,不是数字。还有os.getcwd(),os.chdir(lujing),有意义吗?还有最开头的import data?
Reply Like 0 View the author
https://bbs.deepin.org/post/44283
input接收的是字符,不是数字。还有os.getcwd(),os.chdir(lujing),有意义吗?还有最开头的import data? ...
https://bbs.deepin.org/post/44283
import data是下载的必要....
感谢你的建议,现在程序已经能正常运行了~
https://bbs.deepin.org/post/44283
哦,自己写的模块吗?主要不要使用这么通用的名字,你下面又使用data变量,建议应该避免这样。 ...
Popular Ranking
ChangePopular Events
More
代码如下
import os,urllib.request,re,sys,requests,data
print ('欢迎使用arch安装向导获取器')
resp = requests.get("https://raw.githubusercontent.com/redapple0204/my-boring-python/master/tmp/version-beta")
print('目前最新的测试版本是',resp.text)
resp1 = requests.get("https://raw.githubusercontent.com/redapple0204/my-boring-python/master/tmp/version-stable")
print('目前最新的稳定版本是',resp1.text)
print('请输入您要下载的版本(1为测试版,2为稳定版)')
print('将下载到本程序所在的目录')
shuru = input()
shuru
if (shuru == 1):
lujing = os.getcwd()
os.chdir(lujing)
resp3 = requests.get("https://raw.githubusercontent.com/redapple0204/my-boring-python/master/tmp/version-beta-link")
data = urllib.request.urlopen(resp3,data).read()
with open("arch-install-guide.doc", 'wb') as f:
f.write(data)
if(shuru == 2):
lujing2 = os.getcwd()
os.chdir(lujing2)
resp4 = requests.get("https://raw.githubusercontent.com/redapple0204/my-boring-python/master/tmp/version-stable-link")
data = urllib.request.urlopen(resp4).read()
with open("arch-install-guide.doc", 'wb') as f:
f.write(data)
执行结果如下
redapple@kali ~/Desktop> python3 1.py
欢迎使用arch安装向导获取器
目前最新的测试版本是 codename "happymax" build 004
目前最新的稳定版本是 2.0
请输入您要下载的版本(1为测试版,2为稳定版)
将下载到本程序所在的目录
1
redapple@kali ~/Desktop>
桌面上也并没有这个文件,谁知道怎么回事啊.....