How to remove multiple values from a tuple in python

Advertisements I have a tuple which is an output of a select query. The tuple looks like this: (‘checkStatus id \n========================= ==================== \nfalse adcs-fddf-sdsd \n’, None) I am trying to retrieve only the two values i.e. false and adcs-fddf-sdsd This is the code: import subprocess def foo(): cmd = return ("select checkStatus , id from… Read More How to remove multiple values from a tuple in python

What are the exact differences between Python 2 and Python 3?

Advertisements I couldn’t find a clear information about the differences between these two. What are the key differences between Python 2 and Python 3, and what impact do these differences have on programming in each version? if i write print ‘hello world’ or print(‘hello world’) why is this concern a huge difference for version change?… Read More What are the exact differences between Python 2 and Python 3?

Migrating from Python 2.7 to 3.7 – difference between isinstance(obj, None) vs is None

Advertisements I have to migrate a project from Python 2.7 to 3.7. This line of code used to work in 2.7 if isinstance(obj, None): for some reason it doesn’t anymore. If I modify it this way: if isinstance(obj, type(None)): it will work though. But my question is, what is the difference between this call: isinstance(obj,… Read More Migrating from Python 2.7 to 3.7 – difference between isinstance(obj, None) vs is None

Testing the same function with different parameters

Advertisements I am trying to test a function multiple times using different parameters. The return value should be True. def testConfiguration(small,medium,large): … if (everything goes well): return True else: return False testConfiguration(0,0,1) testConfiguration(1,2,1) testConfiguration(1,3,1) What’s the best way to go about doing this in pytest? I want to avoid multiple functions acting as assert True… Read More Testing the same function with different parameters