我是非常擅长编码所以很抱歉,如果我的代码吼叫你惹恼了大声笑但是我想知道是否有任何方法在raw_input()函数中包含多个参数,这样我就不用了
print("Do you want to filter numbers greater or lower that ", filt, "?")
gorl = raw_input()
而不仅仅是
gorl = raw_input("Do you want to filter numbers greater or lower than ",
filt, "?")
我的整个代码是
import random
import sys
import os
filt = int(raw_input("What number do you want your results to be filtered
by?"))
gorl = raw_input("Do you want to filter numbers greater or lower than ",
filt, "?")
ammvar = int(raw_input("How many variables do you want to filter?"))
var_list = []
varnum = 1
while ammvar > 0:
var_list.append(int(raw_input("Variable ", varnum, ":")))
varnum + 1
ammvar - 1
这就是当我运行它时eclipse返回的内容
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ 您希望将结果过滤到什么数字?10
您希望将其过滤得更高还是更低?更高
您想要过滤多少个变量?7
追踪(最近一次呼叫最后一次):
文件“C:\ Users \ D \ workspace \ Simple \ Sorter__init __。py”,第16行,in
var_list.append(int(raw_input(“Variable”,varnum,“:”)))
TypeError:raw_input()最多需要1个参数(给定3个) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~