Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 需要使用一个列表中的值来查找另一个列表的值的帮助吗_Python 3.x - Fatal编程技术网

Python 3.x 需要使用一个列表中的值来查找另一个列表的值的帮助吗

Python 3.x 需要使用一个列表中的值来查找另一个列表的值的帮助吗,python-3.x,Python 3.x,这是我的密码: def collectData(): print ("Please use correct spelling\n") print("Choose what game type this is") getGameType = input(" FFA: 1\n 1v1: 2\n 2v2: 3\n 3v3: 4\n 4v4: 5\n") if getGameType == "1": FFAPlayerList = [] getFFAMaxLen = (int)(input("

这是我的密码:

def collectData():
print ("Please use correct spelling\n")
print("Choose what game type this is")

getGameType = input(" FFA: 1\n 1v1: 2\n 2v2: 3\n 3v3: 4\n 4v4: 5\n")
if getGameType == "1":

 FFAPlayerList = []

 getFFAMaxLen = (int)(input("How Many players were in this FFA?: "))

 print("Please enter playername as well as placing, seperated by a comma\n(playerName,placing) One player per entry. \n")

 while len(FFAPlayerList) < getFFAMaxLen:
     getFFAPlayers = input("format: playerName,Placing::: ").split(',')
     FFAPlayerList.append(getFFAPlayers)

 with open("C:\\Users\\Twinklenugget\\Documents\\NQGroup\\Databases\\NQMasterDatabase.csv", 'r') as ffaDatabaseExtract:
     reader = csv.reader(ffaDatabaseExtract)
     ffaDatabaseList = list(reader)

     FFAPlayerList.append(ffaDatabaseList)

 print (FFAPlayerList)






collectData()
def collectData():
打印(“请使用正确的拼写\n”)
打印(“选择这是什么游戏类型”)
getGameType=input(“FFA:1\n 1v1:2\n 2v2:3\n 3v3:4\n 4v4:5\n”)
如果getGameType==“1”:
FFAPlayerList=[]
getFFAMaxLen=(int)(输入(“此FFA中有多少玩家?:”)
打印(“请输入playername和Placement,用逗号分隔\n(playername,Placement)每个条目一名玩家。\n”)
而len(FFAPlayerList)

请原谅格式错误,实际上都是正确的。一般来说,我对python和编码都比较陌生。我的目标是能够获取存储在FFAPlayerList(播放器名称)中的值,并使用这些字符串在ffaDatabaseList中查找相同的字符串。在它从ffaDatabaseList中找到相同的字符串之后,我需要从ffaDatabaseList的第二列中获取值,并将它们附加到FFAPlayerList中。我该怎么做呢?即使是一个指向正确方向的指针也很好。

如果我理解正确,您希望在
ffadabaselist
中找到玩家,也可以在
FFAPlayerList
中找到,然后在
FFAPlayerList
中再次添加他们。这就是你想要实现的吗?是的,用户输入的值被输入到FFAPlayerList中,我希望能够检查它们是否在ffaDatabaseList中。如果我理解正确,你希望在
ffaDatabaseList
中找到同样在
FFAPlayerList
中找到的玩家,然后在
FFAPlayerList
中再次添加它们。这就是你想要实现的吗?是的,用户输入的值被输入到FFAPlayerList中,我希望能够检查它们是否在ffaDatabaseList中。