SILENT KILLERPanel

Current Path: > > usr > lib64 > python2.7 > > Demo > comparisons >


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //usr/lib64/python2.7//Demo/comparisons/

NameTypeSizeLast ModifiedActions
README File 2336 bytes April 19 2020 21:13:39.
patterns File 30 bytes April 19 2020 21:13:39.
regextest.py File 1514 bytes April 10 2024 04:57:37.
regextest.pyc File 1089 bytes April 10 2024 04:58:46.
regextest.pyo File 1089 bytes April 10 2024 04:58:46.
sortingtest.py File 1264 bytes April 10 2024 04:57:37.
sortingtest.pyc File 1048 bytes April 10 2024 04:58:46.
sortingtest.pyo File 1048 bytes April 10 2024 04:58:46.
systemtest.py File 2287 bytes April 10 2024 04:57:37.
systemtest.pyc File 1598 bytes April 10 2024 04:58:46.
systemtest.pyo File 1598 bytes April 10 2024 04:58:46.

Reading File: //usr/lib64/python2.7//Demo/comparisons//sortingtest.py

#! /usr/bin/python2.7

# 2)  Sorting Test
#
#     Sort an input file that consists of lines like this
#
#         var1=23 other=14 ditto=23 fred=2
#
#     such that each output line is sorted WRT to the number.  Order
#     of output lines does not change.  Resolve collisions using the
#     variable name.   e.g.
#
#         fred=2 other=14 ditto=23 var1=23
#
#     Lines may be up to several kilobytes in length and contain
#     zillions of variables.

# This implementation:
# - Reads stdin, writes stdout
# - Uses any amount of whitespace to separate fields
# - Allows signed numbers
# - Treats illegally formatted fields as field=0
# - Outputs the sorted fields with exactly one space between them
# - Handles blank input lines correctly

import re
import sys

def main():
    prog = re.compile('^(.*)=([-+]?[0-9]+)')
    def makekey(item, prog=prog):
        match = prog.match(item)
        if match:
            var, num = match.groups()
            return int(num), var
        else:
            # Bad input -- pretend it's a var with value 0
            return 0, item
    for line in sys.stdin:
        items = sorted(makekey(item) for item in line.split())
        for num, var in items:
            print "%s=%s" % (var, num),
        print

main()

SILENT KILLER Tool