Guest User

Untitled

a guest
Feb 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. # Given a KWIC, return a string that is formatted for
  2. # pretty printing.
  3.  
  4. def prettyPrintKWIC(kwic):
  5. n = len(kwic)
  6. keyindex = n // 2
  7. width = 10
  8. outstring = ' '.join(kwic[:keyindex]).rjust(width*keyindex)
  9. outstring += str(kwic[keyindex]).center(len(kwic[keyindex])+6)
  10. outstring += ' '.join(kwic[(keyindex+1):])
  11. return outstring
Add Comment
Please, Sign In to add comment