Skip to main content
added 6 characters in body
Source Link
Andrew Clark
  • 209.7k
  • 36
  • 284
  • 310

Try the following:

self.ignore_dir_extensions = ['xcodeproj']

item = extension.split('/')[0]

print "String: " + repr(item)

if item in self.ignore_dir_extensions:
    print "Available: " + repr(item)

You do not want to have item be the result of repr(), because repr() on a string will add quotes, for example:

>>> repr("xcodeproj")
"'xcodeproj'"
>>> print repr("xcodeproj")
'xcodeproj'
>>> print "xcodeproj"
xcodeproj

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.

Try the following:

self.ignore_dir_extensions = ['xcodeproj']

item = extension.split('/')[0]

print "String: " + repr(item)

if item in self.ignore_dir_extensions:
    print "Available: " + item

You do not want to have item be the result of repr(), because repr() on a string will add quotes, for example:

>>> repr("xcodeproj")
"'xcodeproj'"
>>> print repr("xcodeproj")
'xcodeproj'
>>> print "xcodeproj"
xcodeproj

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.

Try the following:

self.ignore_dir_extensions = ['xcodeproj']

item = extension.split('/')[0]

print "String: " + repr(item)

if item in self.ignore_dir_extensions:
    print "Available: " + repr(item)

You do not want to have item be the result of repr(), because repr() on a string will add quotes, for example:

>>> repr("xcodeproj")
"'xcodeproj'"
>>> print repr("xcodeproj")
'xcodeproj'
>>> print "xcodeproj"
xcodeproj

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.

Source Link
Andrew Clark
  • 209.7k
  • 36
  • 284
  • 310

Try the following:

self.ignore_dir_extensions = ['xcodeproj']

item = extension.split('/')[0]

print "String: " + repr(item)

if item in self.ignore_dir_extensions:
    print "Available: " + item

You do not want to have item be the result of repr(), because repr() on a string will add quotes, for example:

>>> repr("xcodeproj")
"'xcodeproj'"
>>> print repr("xcodeproj")
'xcodeproj'
>>> print "xcodeproj"
xcodeproj

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.