1import sys
2print('Current python version: ', sys.version)
3print('Download dependencies here: ', sys.executable)
1import sys
2print('Python version you are using')
3print(sys.version)
4print('Informantion')
5print(sys.version_info)
6
7
1import sys
2
3class ExpressionCounter(object):
4
5 def __init__(self):
6 self.count = 0
7 self.previous_value = self
8
9 def __call__(self, value):
10 print
11 print ' Previous:', self.previous_value
12 print ' New :', value
13 print
14 if value != self.previous_value:
15 self.count += 1
16 sys.ps1 = '(%3d)> ' % self.count
17 self.previous_value = value
18 sys.__displayhook__(value)
19
20print 'installing'
21sys.displayhook = ExpressionCounter()
22
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
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