def hasargs(msg, command): if len(msg) > len(command): return 1 else: return 0 if command == "!test": pieces = msg.split(' ',1) if hasargs(msg,command): cmd = pieces[1] print 'len(pieces): %s' % len(pieces) print 'we have arguments' print msg.split(' ')[(len(pieces)-1)] print cmd