473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

adjust

Hi,
How do i right adjust my output using python.I need a output
something like this:
DID= 0x01,0x02,0x03,0x05,0x06,0x07,0x2B,0x30,0x31,0x4D, 0x4E,
0x51,0x52,0x53,0x55,
minlength= 3, 3, 4, 2, 10, 10, 40, 2, 150, 4, 1,
2, 2, 1, 2, 1, 6, 3, 17, 1,
maxlength= 3, 3, 4, 2, 10, 10, 40, 2, 150, 4, 1,
2, 2, 1, 2, 30, 6, 3, 17, 20

I am printing from a list, and the values shld print below each id
like shown.
Thx

Apr 24 '07 #1
3 1254
sa**********@gmail.com wrote:
Hi,
How do i right adjust my output using python.I need a output
something like this:
DID= 0x01,0x02,0x03,0x05,0x06,0x07,0x2B,0x30,0x31,0x4D, 0x4E,
0x51,0x52,0x53,0x55,
minlength= 3, 3, 4, 2, 10, 10, 40, 2, 150, 4, 1,
2, 2, 1, 2, 1, 6, 3, 17, 1,
maxlength= 3, 3, 4, 2, 10, 10, 40, 2, 150, 4, 1,
2, 2, 1, 2, 30, 6, 3, 17, 20

I am printing from a list, and the values shld print below each id
like shown.
Thx
http://docs.python.org/lib/typesseq-strings.html

Diez
Apr 24 '07 #2
sa**********@gmail.com wrote:
How do i right adjust my output using python.
http://docs.python.org/lib/typesseq-strings.html
minlength= 3, 3, 4, 2, 10, 10, 40, 2, 150, 4, 1,
2, 2, 1, 2, 1, 6, 3, 17, 1,
Something like:
>>def write_sequence(label, sequence):
.... expanded_text = ",".join("%4d" % item for item in sequence)
.... print "%s=%s" % (label, expanded_text)
....
>>write_sequence("minlength", minlength)
minlength= 3, 3, 4, 2, 10, 10, 40, 2, 150, 4, 1

Completing with a trailing ",", using the entire sequence instead of a
subset, and dealing with your hex constants are left as an exercise to
the reader.
--
Michael Hoffman
Apr 24 '07 #3
On 2007-04-24, sa**********@gmail.com <sa**********@gmail.comwrote:
Hi,
How do i right adjust my output using python.I need a output
something like this:
DID= 0x01,0x02,0x03,0x05,0x06,0x07,0x2B,0x30,0x31,0x4D, 0x4E,
0x51,0x52,0x53,0x55,
minlength= 3, 3, 4, 2, 10, 10, 40, 2, 150, 4, 1,
2, 2, 1, 2, 1, 6, 3, 17, 1,
maxlength= 3, 3, 4, 2, 10, 10, 40, 2, 150, 4, 1,
2, 2, 1, 2, 30, 6, 3, 17, 20

I am printing from a list, and the values shld print below each id
like shown.
Thx
Collect the data to print in rows underneath each other in a list for each
column, decide how wide each column should become, and finally, print out each
line using the computed widths.

Albert
Apr 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dreamer | last post by:
I am making a program for a friend with a disability. I need to adjust his audio volume using the keyboard as he cannot use a mouse. Any suggestions as to how I can raise the volume using the up...
0
by: Jeff O. | last post by:
Has anyone written a class to adjust their Timer period for daylight savings time? Or, is there another way to have the timer automatically adjust for DST?
3
by: Matthew | last post by:
Hello ~ I am looking for a character counter that will display the remaining number of characters left in a form box, that will also display adjust for default values on the form
0
by: RobbRoss | last post by:
I'm trying to adjust the font-size of my header. I can do that until I turn allowsorting=True, then no matter what I set for font-size it doesn't adjust. How can I adjust the header font-size when...
7
by: lauren quantrell | last post by:
A while back I got a requirement for the client to be able to adjust the relative heights of two subforms by click-dragging the mouse and I came up with a kludge solution using a border control...
4
by: Elijsh | last post by:
I'm new to datagrid and VB.Net. Is there any way to adjust the height of datagrid textbox row according to the height of text programmatically ? Your advice is greatly appreciated!
2
by: Elijsh | last post by:
I'm new to datagrid and VB.Net. Is there any way to adjust the height of datagrid textbox row according to the height of text programmatically ? I mean I have multiple data with varied length,...
6
by: Scott Kilbourn | last post by:
Hi, I'm writing a control that inherits from TextBox. I need to adjust the width of this control based on the number of characters in the control. I'm having a hard time with this. The...
6
by: Christopher Glenn | last post by:
I have very basic html skills. My friend who has a wide screen monitor and is using IE7 sent me a jpg screen shot of my home page. I have attached this jpg, but I recall a while back that...
4
by: Terry | last post by:
I am trying to figure out if there is a way to get a regular asp.net TextBox to fill the screen, both height and width. When I drop a TextBox onto a blank asp.net page and set the height="100%",...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.