여기 내 코드의 발췌입니다 통과 가져 오지 : 나는 listFrom('LON')
를 입력하면 예상대로매개 변수가 제대로
def listFrom(here):
print "[DBG] here: " + here
def book(here, there, amount):
print "[DBG] here: " + here + "; there: " + there + "; amount: " + str(amount)
# Code that takes input and stores it into the string input
# Yes, I know this is dangerous, but it's part of a
# school assignment where we HAVE to use eval.
eval(input, {"__builtins__": {}, "listAll": listAll, "listFrom": listFrom, "listFromTo": listFromTo, "book": book, "about": about, "commands": commands, "book": book})
이 프로그램은 [DBG] here: LON
를 반환합니다. 그러나, 내가 할 때 book('LON', 'MAN', 8)
는 설명 할 수없는 것을 얻는다 [DBG] here: ☺; there: ☻; amount: ♥
. 이것의 원인이 무엇일까요?
출력을 어디에서보고 있습니까? IDLE 세션을 게시 할 수 있습니까? 그렇지 않으면 복제가 수행되지 않습니다. – SilentGhost
복제 할 수 없습니다. 어떤 Python과 어떤 플랫폼입니까? –
나를 위해 잘 작동하는 것 같습니다. 사용자 입력을 위해 사용중인 코드를 게시 할 수 있습니까? 또한 문자열 변수를'input'이 아닌 다른 함수라고 부릅니다. 이것은 내장 함수 중 하나입니다. 어떤 Python 버전을 사용하고 있습니까? – tzaman