import urllib,re
def getver():
url='https://github.com/Bendr0id/xmrigCC/releases'
website = urllib.urlopen(url)
html = website.read()
links = re.findall(r'(?<=<a href=")[^"]*\bgcc-win64.zip\b', html)
link=links[0]
version=link.split('/')
ver0=version[5]
return ver0
getver()
I've tried to run the code but it doesnt output anything,instead when I replace return with print it prints out the correct answer which is 1.5.2 . What am I doing wrong?
将最后一行更改为:
print(getver())
You have been fooled by the interactive interpeter's friendly habit of printing out the results of any bare expressions you enter.
This does not happen when you run a program, so you need to ensure you output values specifically by using the print statement.
This is specifically mentioned in a rather obscure portion of the Python documentation dealing with the language's grammar.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.