I have the following piece of code:
self.ignore_dir_extensions = ['xcodeproj']
item = repr(extension.split('/')[0])
print "String: " + item
if item in self.ignore_dir_extensions:
print "Available: " + item
Let’s say I have this output:
String: 'xcodeproj'
Expected output:
String: 'xcodeproj'
Available: 'xcodeproj'
Could anyone help me out here?
Try the following:
You do not want to have
itembe the result ofrepr(), becauserepr()on a string will add quotes, for example:When you are checking to see if the string exists in the list, you don’t want the quotes unless the string you are trying to match also has them.