Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42412

Re: Help with python code!

Newsgroups comp.lang.python
Date 2013-03-31 14:21 -0700
References <37f23623-8bf5-421a-ab6a-34ff622c69f1@googlegroups.com> <mailman.4027.1364762359.2939.python-list@python.org> <2912c674-e30b-4339-9344-1f460cb96b23@googlegroups.com> <roy-AA2630.17134931032013@news.panix.com>
Message-ID <4455829d-5b4a-44ee-b65f-5f72d429ba9c@googlegroups.com> (permalink)
Subject Re: Help with python code!
From jojo <gerrymcgovern@gmail.com>

Show all headers | View raw


On Sunday, March 31, 2013 5:13:49 PM UTC-4, Roy Smith wrote:
> In article <2912c674-e30b-4339-9344-1f460cb96b23@googlegroups.com>,
> 
>  jojo  wrote:
> 
> 
> 
> > for fname in dirList:
> 
> >  cmd = "keytool �printcert �file " + fname
> 
> >  for line in os.popen(cmd).readlines():
> 
> >    line = line.rstrip()
> 
> >    m = p.search(line)
> 
> >    if m:
> 
> >       sue = time.mktime(
> 
> >         (int(m.group(7)), int(months[m.group(2)]), int(m.group(3)),
> 
> >           int(m.group(4)), int(m.group(5)), int(m.group(6)),
> 
> >           int(days[m.group(1)]), 0, 0)
> 
> >         )
> 
> >         expire_time = (sue � current_time)/60/60/24
> 
> >         if expire_time < 0:
> 
> >           print cert_name + " has already expired!"
> 
> >         elif expire_time < 31:
> 
> >           print cert_name + " expires in " +str(int(expire_time)) + " days"
> 
> >        else:
> 
> >         m = q.search(line)
> 
> >         if m:
> 
> >         cert_name = m.group(1)
> 
> 
> 
> Was this code really indented like this when you got it?  You've got (at 
> 
> least) three different indent sizes.  I see 1, 2, and 3 space indents in 
> 
> different places in the code.
> 
> 
> 
> I'm not even sure if this is legal, but even if it is, it's really bad 
> 
> form.  Pick an indent, and stick with it uniformly.  4 spaces seems to 
> 
> be pretty standard.
> 
> 
> 
> That being said, I'm going to return to my previous statement that until 
> 
> you know what the code is *supposed* to do, trying to test it is 
> 
> meaningless.


Hi Rob.

Thanks for your replies. Just to be clear this is for a interview and they would like me to figure out what the code does and come back with some test cases. I don't need to code the tests, just give some high level tests. As far as I can make out it is some system where you input your name and it will bring back your details plus how much time you have left on your card. Have to say I find the code extremely confusing, hopefully all python isn't like this!!

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Help with python code! jojo <gerrymcgovern@gmail.com> - 2013-03-31 13:10 -0700
  Re: Help with python code! Chris Angelico <rosuav@gmail.com> - 2013-04-01 07:39 +1100
    Re: Help with python code! jojo <gerrymcgovern@gmail.com> - 2013-03-31 14:06 -0700
      Re: Help with python code! Roy Smith <roy@panix.com> - 2013-03-31 17:13 -0400
        Re: Help with python code! jojo <gerrymcgovern@gmail.com> - 2013-03-31 14:21 -0700
          Re: Help with python code! Roy Smith <roy@panix.com> - 2013-03-31 17:27 -0400
            Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:32 -0700
              Re: Help with python code! Alister <alister.ware@ntlworld.com> - 2013-04-01 17:54 +0000
            Re: Help with python code! rurpy@yahoo.com - 2013-03-31 14:46 -0700
          Re: Help with python code! Chris Angelico <rosuav@gmail.com> - 2013-04-01 08:35 +1100
            Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:41 -0700
            Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:41 -0700
          Re: Help with python code! Jason Friedman <jsf80238@gmail.com> - 2013-04-02 21:59 -0600
      Re: Help with python code! Chris Angelico <rosuav@gmail.com> - 2013-04-01 08:21 +1100
        Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:24 -0700
        Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:24 -0700
      Re: Help with python code! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-31 23:02 +0100
      Re: Help with python code! Chris Angelico <rosuav@gmail.com> - 2013-04-01 09:04 +1100
    Re: Help with python code! jojo <gerrymcgovern@gmail.com> - 2013-03-31 14:06 -0700
  Re: Help with python code! Roy Smith <roy@panix.com> - 2013-03-31 17:08 -0400

csiph-web