저는 새로운 Python 사용자입니다. 정말 도움이됩니다.Python 가져 오기 "sys import argvs에서"오류가 발생했습니다
from sys import argvs
script, mum_mood, dad_mood = argvs
내 자신의 기능
def dad_and_mum_mood(mum_mood, dad_mood):
print "If both mum and dad are in a good mood, all is good."
print "If one is and one isn't, all is good."
print "If both are in a bad mood, not so good."
print "Mum is in a %s mood" % (mum_mood)
print "Dad is in a %s mood" % (dad_mood)
print "Where does that leave us?"
다음과 같이 내 코드는?
dad_and_mum_mood(mum_mood, dad_mood)
은 그냥
argv
의 (명령 행에 기록)의 정보
mum_mood
및
dad_mood
을 얻으려고 노력하고 있어요,하지만 난 오류
ImportError: cannot import name argvs
를 얻을.
이것이 작동하지 않는 이유는 무엇입니까? 도와 줘서 고마워.
종류 즉 argv
하지 argvs
,
+1은 argparse에 대한 참조입니다. – PaulMcG