-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscratch2.py
More file actions
38 lines (29 loc) · 784 Bytes
/
scratch2.py
File metadata and controls
38 lines (29 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Scratch program of various commands
#
import sys, urllib.request, socket
print("hello")
a=4
x=12
y=4
print("The type of variable a is", type(a))
def times (x,y):
return x*y
try:
# rfc_number = int(sys.argv[1]) 7149 and 7426 for SDN
rfc_number = int(sys.argv[1]) #supply rfc argument at runtime
except (IndexError, ValueError):
print('Must supply an RFC number as first argument')
sys.exit(2)
template = 'http://www.ietf.org/rfc/rfc{}.txt'
url = template.format(rfc_number)
rfc_raw = urllib.request.urlopen(url).read()
rfc = rfc_raw.decode()
print(rfc)
print('End of RFC',rfc_number,'\n\n')
# Chccking a tuple
dict1 = {"Vendor": "Cisco", "Model":" 4507", "IOS": "12.9"}
print(dict1)
print(dict1.items())
print(dict1.keys())
print(dict1.values())
# -30-