- くだすれPython(超初心者用) その27©2ch.net
486 :デフォルトの名無しさん[]:2015/10/10(土) 21:09:48.83 ID:xRAr0t1S - >>482
ほらよっ。 if __name__ == "__main__": path = "tech482.txt" number = "1" L = [] with open(path) as f: for l in f: l = l.strip() # print(l) if not l: # 空行 continue key, value = l.split() if value == number: L.append(key) print("L =") print(L)
|