Browse Source

fixing strings at 8 chars

import/heads/master
Cian Brennan 11 years ago
parent
commit
ed7c7ecf16
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      rbusers.py

+ 4
- 4
rbusers.py View File

@@ -6,8 +6,8 @@ import sys
users = utmp.UtmpRecord()
logged_users = {}
#two format strings, to take a/c of users with >10 sessions
format_string_norm = '%s%8s \033[;0m\033[;032m(\033[;033m%d\033[;032m) '
format_string_10 = '%s%8s\033[;0m(%d)'
format_string_norm = '%s%s \033[;0m\033[;032m(\033[;033m%d\033[;032m) '
format_string_10 = '%s%s\033[;0m(%d)'
#set colours if we have an encoding
if sys.stdout.encoding is not None :
default_colour = '\033[;0m'
@@ -84,10 +84,10 @@ for user in list_users :
iter = iter + 1
if logged_users[user][0] < 10 :
print format_string_norm % ( logged_users[user][1],
user.ljust(8), logged_users[user][0] ),
user.ljust(8)[:8], logged_users[user][0] ),
else :
print format_string_10 % ( logged_users[user][1],
user.ljust(8), logged_users[user][0] ),
user.ljust(8)[:8], logged_users[user][0] ),
if iter >= 5 :
iter = 0
print


Loading…
Cancel
Save