E Edinei New Member Sep 23, 2023 #1 Hi everybody! I have a list like [1, 2, 3, 4, 5, 6, 7] and a csv file (text.csv) like this: game1, 1, 2, 3, 4, 5 game2, 2, 6, 7, 8, 9 game3, 10, 11, 12, 13 I need to seek in csv file wich list numbers match and presents something like this: game1: match 1 number game2: match 2 numbers game3: no match May someone help me?
Hi everybody! I have a list like [1, 2, 3, 4, 5, 6, 7] and a csv file (text.csv) like this: game1, 1, 2, 3, 4, 5 game2, 2, 6, 7, 8, 9 game3, 10, 11, 12, 13 I need to seek in csv file wich list numbers match and presents something like this: game1: match 1 number game2: match 2 numbers game3: no match May someone help me?
Andrew (Digitwell) Well-Known Member Licensed User Longtime User Sep 24, 2023 #2 what have your tried so far? the algorithm I would use would be something like. load the 2 files with stringutils.loadcsv - text.csv (a) and input.csv (b) split (a) using regex. split into an array of strings. in a for loop with the list of lines from (b) , regex.split the line of (b). Element(0) is the gamename, the rest are the numbers to compare in another for loop, compare each element item with the list of (a) adding 1 to the count for each match keep a count for each line print out the result Good Luck! Upvote 0
what have your tried so far? the algorithm I would use would be something like. load the 2 files with stringutils.loadcsv - text.csv (a) and input.csv (b) split (a) using regex. split into an array of strings. in a for loop with the list of lines from (b) , regex.split the line of (b). Element(0) is the gamename, the rest are the numbers to compare in another for loop, compare each element item with the list of (a) adding 1 to the count for each match keep a count for each line print out the result Good Luck!