Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
List comprehension to search and add
#python 3.5.2 list_1 = ['rwww corp\pan 2323 2018-23-23 0% c:\program files\pa.txt', 'rwww corp\pand 2323 2018-23-23 0% c:\program files\monkey.txt', 'c:\program files\pa.txt', 'c:\program files\pex2.txt', 'c:\program files\pex5.txt', 'c:\program files\pex4.txt', ] list_2 = ['c:\program files\pa.txt', 'c:\program files\pex2.txt', 'c:\program files\pex3.txt',] # You should not use list comprehension for this purpose # It will print items in list_1 if it also exists in list_2 [print(e, 'exists in list_1') for e in list_2 if e in list_1]
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Linear Regression Python
my first print
Lesson5-
количество 1 и 0 в последовательности чисел до n
yield from example
calculate the sum of string 201test70de88qa ( only numbers)
rstring
Lesson 2-ex
Sum
PYTHON 3
stackse - search stackoverflow differently
Please log in to post a comment.