Home > other >  Python small white one, download a project today, but run shows lack of parameter, don't unders
Python small white one, download a project today, but run shows lack of parameter, don't unders

Time:12-01

 
The import OS
The import argparse


If __name__=="__main__ ':
Parser=argparse. ArgumentParser (description="Wechat helper (WeChat little helper), the Author: Charles, Wechat Official Accounts: Charles_pikachu (WeChat public number: Charles Pikachu), Version: V0.1.0")
Parser. Add_argument (' -o ', dest='option', help='Choose the function you need, o & lt; AnalysisFriends> , , and . \
(choose the features you need, but options include: friends analysis & lt; AnalysisFriends> , message back & lt; AntiWithdrawal> And open the automatic bot & lt; WechatRobot> Auto reply and WeChat news & lt; AutoReply>) ')
Parser. Add_argument (' - k, dest='keywords', help=' keywords for & lt; AutoReply> , use "*" to separate the if keywords is more than one. (choose the keywords autoRelpy function, if there are multiple keywords to use * separation) ')
Parser. Add_argument (' - 'c, dest=' contents', help='contents for & lt; AutoReply> , use "*" to separate the if contents is more than one. (choose autoRelpy function when the reply content, if there are multiple reply content with * separated) ')
Args=parser. Parse_args ()
If args. Option=='analysisFriends:
The from utils. AnalysisFriends import analysisFriends
Print (' [INFO] : analysisFriends... ')
The -savedir=OS. Path. Join (OS getcwd (), 'results')
AnalysisFriends (). The run (the -savedir=the -savedir)
Print (' [INFO] : analysis friends successfully, the results saved into % s... Success (WeChat friends analysis, the results stored in the % s... ) '% (the -savedir, the -savedir))
Elif args. Option=='antiWithdrawal:
The from utils. AntiWithdrawal import antiWithdrawal
Print (' [INFO] : antiWithdrawal... ')
AntiWithdrawal (). The run ()
Elif args. Option=='wechatRobot:
The from utils. WechatRobot import wechatRobot
Print (' [INFO] : wechatRobot... ')
WechatRobot (). The run ()
Elif args. Option=='autoReply:
The from utils. AutoReply import autoReply
Print (' [INFO] : autoReply... ')
Keywords=args. Keywords
Contents=args. Contents
If keywords:
Keywords=keywords. The split (' * ')
If contents:
Contents=contents. The split (' * ')
AutoReply (). The run (keywords=keywords, replycontents=contents)
The else:
Print (' [INFO] : argparse error... (argument parsing error, can option must be & lt; AnalysisFriends> , , Or & lt; AutoReply>) ')



When I put the py files in the VSCode runtime, appeared the following situation


The small white is also on the learning phase, for this problem, is not very understanding, the great spirit guide

CodePudding user response:

Or, should I how to operate, can normal operation of the py files, to listen to

CodePudding user response:

In front of the if this is your file, elif accords with a condition, is not running, running is the last of the else, print the last line of the content, also do not belong to the error
  • Related