Text processing/Max licenses in use: Difference between revisions
Content added Content deleted
(→{{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: | Line 1,497: | ||
=={{header|Python}}== |
=={{header|Python}}== |
||
<lang python>out = 0 |
<lang python>out, max_out, max_times = 0, -1, [] |
||
max_out = -1 |
|||
max_times = [] |
|||
for job in open('mlijobs.txt'): |
for job in open('mlijobs.txt'): |
||
if "OUT" in job |
out += 1 if "OUT" in job else -1 |
||
⚫ | |||
else: |
|||
out -= 1 |
|||
if out > max_out: |
if out > max_out: |
||
max_out = out |
max_out, max_times = out, [] |
||
max_times = [] |
|||
if out == max_out: |
if out == max_out: |
||
max_times.append(job.split()[3]) |
max_times.append(job.split()[3]) |
||
⚫ | |||
⚫ | |||
print(' ' + '\n '.join(max_times))</lang> |
|||
{{out}} |
|||
⚫ | |||
for time in max_times: |
|||
print " ", time</lang> |
|||
Example output: |
|||
<pre>Maximum simultaneous license use is 99 at the following times: |
<pre>Maximum simultaneous license use is 99 at the following times: |
||
2008/10/03_08:39:34 |
2008/10/03_08:39:34 |