这是我的代码:
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()
原谅格式化,它实际上都是正确的。我相对来说是python和编码的新手。我的目标是能够获取存储在FFAPlayerList中的值(播放器名称)并使用这些字符串在ffaDatabaseList中查找相同的字符串。在从ffaDatabaseList找到相同的字符串之后,我需要从ffaDatabaseList的第二列中获取值并将它们附加到FFAPlayerList中。我到底该怎么做呢?即使是正确方向的指针也会很棒。