Search Results

Search found 1 results on 1 pages for 'amadain'.

Page 1/1 | 1 

  • python eval weirdness

    - by amadain
    Hi Folks I have the following code in one of my classes along with checks when the code does not eval: filterParam="self.recipientMSISDN==tmpBPSS.split('_')[3].split('#')[0] and self.recipientIMSI==tmpBPSS.split('_')[3].split('#')[1]" if eval(filterParam): print "Evalled" else: print "Not Evalled\nfilterParam\n'%s'\ntmpBPSS\n'%s'\nself.recipientMSISDN\n'%s'\nself.recipientIMSI\n'%s'" % (filterParam, tmpBPSS, self.recipientMSISDN, self.recipientIMSI) I am not getting anything to 'eval'. Here are the results: Not Evalled filterParam 'self.recipientMSISDN==tmpBPSS.split('_')[3].split('#')[0] and self.recipientIMSI==tmpBPSS.split('_')[3].split('#')[1]' tmpBPSS 'bprm_DAILY_MO_919844000039#892000000' self.recipientMSISDN '919844000039' self.recipientIMSI '892000000' So I used the outputs from the above to check the code in a python shell and as you can see the code evalled correctly: >>> filterParam="recipientMSISDN==tmpBPSS.split('_')[3].split('#')[0] and recipientIMSI==tmpBPSS.split('_')[3].split('#')[1]" >>> tmpBPSS='bprm_DAILY_MO_919844000039#892000000' >>> recipientMSISDN='919844000039' >>> recipientIMSI='892000000' >>> if eval(filterParam): ... print "Evalled" ... else: ... print "Not Evalled" ... Evalled Am I off my rocker or what am I missing? A

    Read the article

1