Newbie, homework help, please.

someone wesbroom at gmail.com
Sat Apr 21 17:11:12 EDT 2012


On Saturday, April 21, 2012 3:44:49 PM UTC-5, BartC wrote:
> "someone" <wesbroom at gmail.com> wrote in message
> news:9071485.2215.1335040139144.JavaMail.geo-discussion-forums at yniw15...
> 
> > Thanks Bart for trying, it helped me out a little more by showing me a
> > little more than I knew, but I tried and I am not sure if it does fit my
> > example due to it was too many stars in between the lines, and not match
> > up, but if you see any more help, that would be great, or see something I
> > am doing wrong, or figure something out, let me know, have a great day,
> > again, thanks
> 
> Here's the example you posted:
> 
> ***********************
> *                     *
> * First Name and Last *
> * ENGR 109-X          *
> * Fall 2999           *
> * Format Example      *
> *                     *
> ***********************
> 
> And here's the output from both bits of code I posted, which has 'one inch' 
> of white space all around; both examples must be viewed with a fixed-pitch 
> font (or in 'code' mode):
> 
> 
> 
> 
> 
> 
>           ***********************
>           *                     *
>           * First Name and Last *
>           * ENGR 109-X          *
>           * Fall 2999           *
>           * Format Example      *
>           *                     *
>           ***********************
> 
> 
> 
> 
> 
> Please post the output you're getting that has too many asterisks.
> 
> -- 
> Bartc

Hi, Bart: Thank you, your post is working now, maybe, I did something wrong, unfortunately, you are right, my setup for getting the file to pull up correctly now is an issue, At first, I got a Vertical line with it working, then I tried to tinker with it, and it fratched, lol
def border(text):
 maxwidth=0
 for s in text:
  if len(s)>maxwidth: maxwidth=len(s)
 vertinchlines=6    # assume 6 lines/inch
 hozinchchars=10    # assume 10 chars/inch
 hozmargin=" "*hozinchchars
 newtext=[]
 for i in range(vertinchlines):
  newtext.append("")
 newtext.append(hozmargin+"*"*(maxwidth+4)+hozmargin)
 newtext.append(hozmargin+"* "+" "*maxwidth+" *"+hozmargin)
 for s in text:
  newtext.append(hozmargin+"* "+s+" "*(maxwidth-len(s))+" *"+hozmargin)
 newtext.append(hozmargin+"* "+" "*maxwidth+" *"+hozmargin)
 newtext.append(hozmargin+"*"*(maxwidth+4)+hozmargin)
 for i in range(vertinchlines):
  newtext.append("")
 return newtext
x=textfile;indat=open(x,'r');SHI=indat.read()
textTuple = border(SHI)
for lines in textTuple:
 print ("%s\n" %textTuple)


The issue is trying to get the SHI to work right, but omg, this is the closes I have gotten, you are awsome, thank you very much, i guess i will just keep messing with it till i get it



More information about the Python-list mailing list