Jump to content

Text processing/Max licenses in use: Difference between revisions

→‎{{header|Python}}: Update for Python 2.7 & 3.X compatability
(→‎{{header|REXX}}: added comments in 2nd section header about what REXXes return what ENV strings. -- ~~~~)
(→‎{{header|Python}}: Update for Python 2.7 & 3.X compatability)
Line 1,497:
 
=={{header|Python}}==
<lang python>out, max_out, max_times = 0, -1, []
max_out = -1
max_times = []
 
for job in open('mlijobs.txt'):
out += 1 if "OUT" in job: else -1
out += 1
else:
out -= 1
if out > max_out:
max_out, max_times = out, []
max_times = []
if out == max_out:
max_times.append(job.split()[3])
out += 1
print ("Maximum simultaneous license use is", max_out,%i "at the following times:" % max_out)
print(' ' + '\n '.join(max_times))</lang>
 
{{out}}
print "Maximum simultaneous license use is", max_out, "at the following times:"
for time in max_times:
print " ", time</lang>
Example output:
<pre>Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.