Created
September 10, 2018 19:19
-
-
Save putarpuar/5471a01f581cc983c8284fd1d6369dd2 to your computer and use it in GitHub Desktop.
package ubuntu version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import re | |
import io | |
packages = ["apache2", "java-common", "nginx", "vim", "slurm"] | |
regex="<h1>(.*)</h1>" | |
for i in packages: | |
url = "https://packages.ubuntu.com/bionic/%s" % i | |
req = urllib.request.Request(url) | |
resp = urllib.request.urlopen(req) | |
respData = resp.read() | |
h1 = re.findall(regex, str(respData)) | |
split = h1[0].split() | |
slice_str = str(split[2]) | |
test = re.match(r"^\d{1}(.*)\d{1}", slice_str[1:]) | |
print(test.group(0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment