1import sys
2print('Python version you are using')
3print(sys.version)
4print('Informantion')
5print(sys.version_info)
6
7
1def displayhook(value):
2 if value is None:
3 return
4 # Set '_' to None to avoid recursion
5 builtins._ = None
6 text = repr(value)
7 try:
8 sys.stdout.write(text)
9 except UnicodeEncodeError:
10 bytes = text.encode(sys.stdout.encoding, 'backslashreplace')
11 if hasattr(sys.stdout, 'buffer'):
12 sys.stdout.buffer.write(bytes)
13 else:
14 text = bytes.decode(sys.stdout.encoding, 'strict')
15 sys.stdout.write(text)
16 sys.stdout.write("\n")
17 builtins._ = value
18
1if sys.platform.startswith('freebsd'):
2 # FreeBSD-specific code here...
3elif sys.platform.startswith('linux'):
4 # Linux-specific code here...
5elif sys.platform.startswith('aix'):
6 # AIX-specific code here...
7
1# arguments
2def test_var_args(f_arg, *argv):
3 print("first normal arg:", f_arg)
4 for arg in argv:
5 print("another arg through *argv :", arg)
6
7test_var_args('yasoob','python','eggs','test')
8
9# keywork arguments
10def test_var_kwargs(f_arg, **kwargs):
11 print(f_arg)
12 for (key, item) in kwargs.items():
13 print("Keyword: ", key)
14 print("Value: ", item)
15
16test_var_kwargs('yasoob', x = 12)
17