1
嗨,我正在做一個程序,需要輸入command
但即使輸入是清楚的「A」,但它什麼都不做,並繼續。這裏是代碼:Python輸入不工作
import os
import socket
import time
print("The Program is starting")
print("")
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
print("Socket created")
print("")
def command_taking():
command = input("Command: ")
print(command)
time.sleep(0.1)
if command == "A":
print("of")
target = str(input("Ip of the target: "))
print("")
print("The target is", target)
command_taking()
os.system("pause")
什麼'print(ascii(command))'顯示? – jfs
通過用'raw_input'替換'input'來檢查你是否真正使用了python 3.x。如果出現錯誤,則使用3.x,否則'raw_input'將解決您的問題。 – randomusername
已經嘗試過:C我有python 3.2 – user2557470