python printout format

Discussion in 'Python' started by Yong Wang, Feb 1, 2006.

  1. Yong Wang

    Yong Wang Guest

    Hi,
    I have a data set like row = [[1,2,3,4,5], [6,7,8,9,10], [11,12,13,14,15]]
    when I use loop to print out data, I got compile error in printout statment.
    while j<24:
    print ' ',string.ljust(str(units[0]), 5),
    print ' ',string.ljust(str(ports[j], 3),
    print ' ',string.ljust(PortlinkbeatInv[row[j][0]],14),
    print ' ',string.ljust(PortStatusInv[row[j][1]], 19),
    print ' ',string.ljust(PortTestResultInv[row[j][2]],17),
    print ' ',string.ljust(PortVisualInv[row[j][3]],19),
    print ' ',string.ljust(PortAddrVioInv[row[j][4]],15)
    j=j+1
    misc.doPg('Port status listing on ' + tag + ' (Page %d):',
    vals,doBanner,doRow)

    Error messages are:
    python -c "import compileall; compileall.compile_dir('.',0)"
    Listing . ...
    Compiling ./Ciscoports.py ...
    File "./Ciscoports.py", line 753
    print string.ljust(PortlinkbeatInv[row[j][0]],14),
    ^
    SyntaxError: invalid syntax


    How should I change to printout row data [1,2,3,4,5] in one row in assigned format?
    Many thanks,

    Yong
     
    Yong Wang, Feb 1, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TJS
    Replies:
    0
    Views:
    309
  2. Mike Grace

    Can I output a printout as a tif?

    Mike Grace, Aug 27, 2003, in forum: Java
    Replies:
    1
    Views:
    381
    Mike Grace
    Aug 27, 2003
  3. Bill Dennis

    Imbedding Word Files in Printout

    Bill Dennis, Dec 5, 2003, in forum: Java
    Replies:
    0
    Views:
    332
    Bill Dennis
    Dec 5, 2003
  4. Replies:
    3
    Views:
    555
    John C. Bollinger
    Mar 8, 2006
  5. Avrajit

    Python printout

    Avrajit, Nov 27, 2012, in forum: Python
    Replies:
    1
    Views:
    188
    Avrajit Chatterjee
    Jan 3, 2013
Loading...

Share This Page