示例#1
0
   sorted_dict = sort_by_value(mydict)
   print sorted_dict

   toto = [3, 4, 5]
   print range(1, len(toto))

   toto = [132, 32, 0, -1, 28, -3, 203, 45, 2]
   titi = [ 1,   2, 3,  4,  5,  6,  7,   8, 9]

   selectionSort(toto)

   toto = [132, 32, 0, -1, 28, -3, 203, 45, 2]
   titi = [ 1,   2, 3,  4,  5,  6,  7,   8, 9]
   print
   print toto
   print titi
   doubleSelectionSort(toto, titi)


   tata = [0, 1, 2, 3]
   print tata[-1:]
   print tata[3:]
   print tata[4:]

   tutu = Manager("NULL")

   filepath = "/apps/pds/tools/Columbo/etc/Columbo.conf"
   lines = tutu.easyTail(filepath, 20)
   for line in lines: print line,
   
示例#2
0
    mydict = {1: 1, 2: 2, 5: 1, 10: 2, 44: 3, 67: 2}
    sorted_dict = sort_by_value(mydict)
    print sorted_dict

    toto = [3, 4, 5]
    print range(1, len(toto))

    toto = [132, 32, 0, -1, 28, -3, 203, 45, 2]
    titi = [1, 2, 3, 4, 5, 6, 7, 8, 9]

    selectionSort(toto)

    toto = [132, 32, 0, -1, 28, -3, 203, 45, 2]
    titi = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    print
    print toto
    print titi
    doubleSelectionSort(toto, titi)

    tata = [0, 1, 2, 3]
    print tata[-1:]
    print tata[3:]
    print tata[4:]

    tutu = Manager("NULL")

    filepath = "/apps/pds/tools/Columbo/etc/Columbo.conf"
    lines = tutu.easyTail(filepath, 20)
    for line in lines:
        print line,
示例#3
0
文件: easyTail.py 项目: khosrow/metpx
    message = """Should not be called directly, it is normally called by dtail"""
    print message


try:
    opts, args = getopt.getopt(sys.argv[1:], "an:u")
except getopt.GetoptError:
    usage()
    sys.exit(2)

manager = Manager("NULL")

if "-n" not in opts:
    number = 5  # Default number of lines to be viewed
for o, a in opts:
    if o == "-n":
        if a > 0:
            number = a
        else:
            print "Number of lines should be greater than 0!"
            sys.exit(2)
    if o == "-a":  # We want to read all the file
        number = 'all'

machine = args.pop()
filepath = args.pop()

lines = manager.easyTail(filepath, number)
for line in lines:
    print machine.upper() + ": " + line,