Reputation: 611
I'm pretty new to Python and I'm trying to do something. I'm using a Python IRC bot which let's me build functions that are used as commands on the channel. I have obtained a python version of Cleverbot and would like to link these 2 together. But becuase I'm not good with Python I'm not sure how to do it.
To use the cleverbot python I would simply type in a terminal:
python cleverbot.py
And it would give me a "> " where I can input. Then I say on that line "Hello" and the cleverbot script will print the result using a print command.
So, I've been messing around and have discovered I can use the Python IRC bot commands to print a string, so it will simply print the results string for me. The problem is I can't get it to input anything to the cleverbot script. I was hoping it was possible to do something like:
print python cleverbot.py "hello"
And it would simply print the response from Cleverbot, does that make sense? I could then simply use the IRC commands to print the response to the channel.
Thanks in advance, and I hope it was possible to understand.
Upvotes: 0
Views: 298
Reputation: 250941
inside cleverbot.py
you can you these statements to print the command line argument provided:
import sys
print(sys.argv[1]) #or print(' '.join(sys.argv[1:])) if the arguments are more than one
so now python cleverbot.py hello
will print hello
Upvotes: 1