![]() |
Help - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Help (/thread-30545.html) |
Help - virtual_claude - Oct-25-2020 Hi All, Please go easy on me, I am new to this and I have never programmed/scripted before. I am trying to learn python, and really struggling with it... can anyone help me with the following, that I can't seem to get running: ################# # Main Function # ################# def main(): print ('Welcome to the Network analysis tool') userInput = input ('What would you like to do: ') if userInput == '-p' or '--passive': #then run in passive mode # elif userInput == '-a' or '--active': #then run in active mode #else # help(): main() When I try to run it, I get: File "./net_recon.py", line 27 main() ^ IndentationError: expected an indented block I have indented main() and get the same thing.... Thanks, C. RE: Help - jefsummers - Oct-25-2020 Your if statement requires a code block to follow the colon, and you have just comment lines. Add (indented) the command pass after that line. Then you can start working the other issues. Also, in the future, please post code between python tags. Easy way to do that is copy the code, then tap the blue and yellow python icon in the editor on the website, then ctrl-v to paste RE: Help - virtual_claude - Oct-26-2020 Thanks jefsummers! It seems like no matter what I do, I cant get it to run (except when I comment out the if statement). Thanks for the heads up about the python code entry button. I've tried: userInput = input ('What would you like to do today: ') if userInput == '-p' or '--passive': userInput = input ('What would you like to do today: ') if userInput == '-p' or '--passive': and userInput = input ('What would you like to do today: ') if userInput == '-p' or '--passive': ![]() ![]() [python=#!/usr/bin/python3 ################# # Help Function # ################# #def help(): # print ("Please enter one of the following options:") # print ("-p or --passive - for monitoring ARP traffic" # print ("-a or --active - for active mode for ping sweep") #help() ################# # Main Function # ################# def main(): print ('Welcome to the Network Recon tool') userInput = input ('What would you like to do today: ') if userInput == '-p' or '--passive': #then run in passive mode # elif userInput == '-a' or '--active': #then run in active mode #else # help(): main()][/python] I'll keep trying though. Thanks, C. RE: Help - jefsummers - Oct-26-2020 def main(): print ('Welcome to the Network Recon tool') userInput = input ('What would you like to do today: ') if userInput == '-p' or userInput == '--passive': pass #then run in passive mode # elif userInput == '-a' or '--active': #then run in active mode #else # help():Try making those 2 changes RE: Help - virtual_claude - Oct-28-2020 (Oct-26-2020, 09:11 PM)jefsummers Wrote:def main(): print ('Welcome to the Network Recon tool') userInput = input ('What would you like to do today: ') if userInput == '-p' or userInput == '--passive': pass #then run in passive mode # elif userInput == '-a' or '--active': #then run in active mode #else # help():Try making those 2 changes Perfect. Thank you very much!! C. |