print statement in python
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4996837/why-am-i-not-getting-any-output">Why am I not getting any output?</a>  </p>
</blockquote>



<p>If I need to put the print commands and statements to check the code then how do I Insert it?please explain it to me by providing an example from the below code?</p>

<pre><code>service = ('u', 'urn:schemas-upnp-org:service:SwitchPower:1')
binary_light_type = 'urn:schemas-upnp-org:device:BinaryLight:1'

def on_new_device(dev):
    """ Callback triggered when a new device is found.
    """
    print 'Got new device:', dev.udn
    print "Type 'list' to see the whole list"

    if not dev:
        return

def get_switch_service(device):
    return device.services[service[1]]

def create_control_point():
    """ Creates the control point and binds callbacks to device events.
    """

    c = ControlPoint()

    c.subscribe('new_device_event', on_new_device)
    c.subscribe('removed_device_event', on_removed_device)
    return c

def main():
    """ Main loop iteration receiving input commands.
    """

    c = create_control_point()
    c.start()
    run_async_function(_handle_cmds, (c, ))
    reactor.add_after_stop_func(c.stop)
    reactor.main()


def _exit(c):
    """ Stops the _handle_cmds loop
    """

    global running_handle_cmds
    running_handle_cmds = False


def _search(c):
    """ Start searching for devices of type upnp:rootdevice and repeat
    search every 600 seconds (UPnP default)
    """

    c.start_search(600, 'upnp:rootdevice')


def _get_status(c):
    """ Gets the binary light status and print if it's on or off.
    """

    try:
        service = get_switch_service(c.current_server)
        status_response = service.GetStatus()
        if status_response['ResultStatus'] == '1':
            print 'Binary light status is on'
        else:
            print 'Binary light status is off'
    except Exception, e:
        if not hasattr(c, 'current_server') or not c.current_server:
            print 'BinaryLight device not set.Please use set_light &lt;n&gt;'
        else:
            print 'Error in get_status():', e


def _get_target(c):
    """ Gets the binary light target and print if it's on or off.
    """
    try:
        service = get_switch_service(c.current_server)
        status_response = service.GetTarget()
        if status_response['RetTargetValue'] == '1':
            print 'Binary light target is on'
        else:
            print 'Binary light target is off'
    except Exception, e:
        if not hasattr(c, 'current_server') or not c.current_server:
            print 'BinaryLight device not set.Please use set_light &lt;n&gt;'
        else:
            print 'Error in get_target():', e

def _stop(c):
    """ Stop searching
    """

    c.stop_search()

def _list_devices(c):
    """ Lists the devices that are in network.
    """

    k = 0
    for d in c.get_devices().values():
        print 'Device no.:', k
        print 'UDN:', d.udn
        print 'Name:', d.friendly_name
        print 'Device type:', d.device_type
        print 'Services:', d.services.keys() # Only print services name
        print 'Embedded devices:', [dev.friendly_name for dev in \
             d.devices.values()] # Only print embedded devices names
        print

        k += 1





if __name__ == '__main__':

    main()
</code></pre>
