Not sure if this is a rookie mistake or plain stupid, but I am facing this strange issue. I have a unicoded string declared as classifier = u"''" which I am checking for emptiness.
The following code block:
if classifier:
# do something
else:
# else do something else
will hit the else block since there is '' embedded. I don't have control over the source generating classifier string.
Only if classifier can somehow be operated to return the embedded '' I can check for emptiness of classifier, but not sure how. If it is of any help classifier is collected from HttpRequest object classifier = request.GET.get('c', '').
EDIT:
classifier[1:-1] returns u'' which now can be checked for emptiness. Any built in method which one can use?
I will go ahead with this approach for now. But leaving the post open for any other advanced pointers if any.
thanks,
u"''"is not an empty string, it's a string containing twou"'"characters. Is it possible that the source is giving you something like JSON that you need to parse to get the actual data?http://<someurl>/a=maven&v=1.1.0&classifier=''&ttype=pom. Thanks for your pointer though.