I have printed the contents of 2 folders to separate txt files. It is in the form of a python list How could I loop through the files looking for matching list elements? My first problem is how to extract the words from out of the quotes and the second should come easily since I would just have to find that same pattern in the 2nd txt file. Any ideas?
planetPlosion
3
Newbie Poster
Recommended Answers
Jump to PostI've heard only bad things about eval + strings.
Maybe I'm better off not printing them to files?I need to be able to search out of order in the lists to compare them
for item in List1:
search List2 for item
if match is found
next item
else print …
Jump to PostYou can use
set
x = set(mu1List) y = set(mu2List) a = x - y # set of items in x but not in y (set difference) b = x & y # set of items in both sets (set intersection) c = y - …
All 6 Replies
Gribouillis
1,391
Programming Explorer
Team Colleague
planetPlosion
3
Newbie Poster
cghtkh
9
Junior Poster
Gribouillis
1,391
Programming Explorer
Team Colleague
planetPlosion
commented:
straighted my knowledge of eval out
+3
planetPlosion
3
Newbie Poster
Gribouillis
1,391
Programming Explorer
Team Colleague
planetPlosion
commented:
perfect
+3
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.