Re: [Tutor] printing tree structure

2009-07-03 Thread Alan Gauld
"karma" wrote thinking that a recursive solution would work here, but so far I can't quite get it working. This is what I have so far: Can someone suggest whether this is suited to a recursive solution and Yes certainly if so, what am I doing wrong. L = ['a', ['b',

Re: [Tutor] printing tree structure

2009-07-03 Thread Lie Ryan
karma wrote: > Hi all , > > I have a nested list in the structure > [root,[leftSubtree],[RightSubtree]] that I want to print out. I was > thinking that a recursive solution would work here, but so far I can't > quite get it working. This is what I have so far: > > Can someone suggest whether this

[Tutor] printing tree structure

2009-07-03 Thread karma
Hi all , I have a nested list in the structure [root,[leftSubtree],[RightSubtree]] that I want to print out. I was thinking that a recursive solution would work here, but so far I can't quite get it working. This is what I have so far: Can someone suggest whether this is suited to a recursive sol

Re: [Tutor] printing a list to a window

2009-06-16 Thread Alan Gauld
"Essah Mitges" wrote What I am trying to do is print a high score text file to a pygame window it kinda works... How do you define kinda? It doesn't look like it works to me. The function main defined as def main(): high_file = open_file("high_score.txt", "r") score = next_block(high_

Re: [Tutor] printing a list to a window

2009-06-16 Thread Wayne
On Tue, Jun 16, 2009 at 4:27 PM, Essah Mitges wrote: > > What I am trying to do is print a high score text file to a pygame window > it kinda works...I don't know how to go about doing this... > Do you know how to print text to a window? to read a file, just in a terminal window: f = open('som

Re: [Tutor] Printing Problem python 3

2009-04-29 Thread Vern Ceder
Dave Crouse wrote: I got the same thing with idle, but when running as a script, it's not the same, it errors. I tried it on Windows and Linux. --- [da...@arch64 Python]$ less test.py #/usr/bin/python3 print ('The \"This is a test \" {') [da...@arch64 Py

Re: [Tutor] Printing Problem python 3

2009-04-29 Thread Dave Crouse
I got the same thing with idle, but when running as a script, it's not the same, it errors. I tried it on Windows and Linux. --- [da...@arch64 Python]$ less test.py #/usr/bin/python3 print ('The \"This is a test \" {') [da...@arch64 Python]$ sh test.py tes

Re: [Tutor] Printing Problem python 3

2009-04-29 Thread Shantanoo Mahajan (शंत नू महा जन)
On 30-Apr-09, at 12:12 AM, Dave Crouse wrote: Trying to print something with a { in it. Probably extremely simple, but it's frustrating me. :( print ('The \"This is a test \" {') i get this error ValueError: Single '{' encountered in format string Worked perfectly for me. === $ python3.0

Re: [Tutor] Printing Problem python 3

2009-04-29 Thread Dave Crouse
The double {{ }} worked perfectly, THANK YOU ! :) This was driving me crazy. On Wed, Apr 29, 2009 at 2:03 PM, Kent Johnson wrote: > print ('The \"This is a test \" {') > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/

Re: [Tutor] Printing Problem python 3

2009-04-29 Thread Kent Johnson
On Wed, Apr 29, 2009 at 2:42 PM, Dave Crouse wrote: > Trying to print something with a { in it. > Probably extremely simple, but it's frustrating me.  :( > > print ('The \"This is a test \" {') > > i get this error > > ValueError: Single '{' encountered in format string It works for me: Python 3.

[Tutor] Printing Problem python 3

2009-04-29 Thread Dave Crouse
Trying to print something with a { in it. Probably extremely simple, but it's frustrating me. :( print ('The \"This is a test \" {') i get this error ValueError: Single '{' encountered in format string ___ Tutor maillist - Tutor@python.org http://ma

Re: [Tutor] printing files

2009-03-26 Thread Alan Gauld
"Kent Johnson" wrote On Thu, Mar 26, 2009 at 2:58 PM, ALAN GAULD wrote: Use '\n'.join(handle[1:]) It will create a string from your list with newline as separator. The lines from readlines() include the newlines already. Ah, OK, I couldn't remember if readlines stripped them off or not.

Re: [Tutor] printing files

2009-03-26 Thread Kent Johnson
On Thu, Mar 26, 2009 at 2:58 PM, ALAN GAULD wrote: > Use '\n'.join(handle[1:]) > It will create a string from your list with newline as separator. The lines from readlines() include the newlines already. > When i use the following > > print>>out, handle[1:] > > In the out file, it saves the line

Re: [Tutor] printing files

2009-03-26 Thread ALAN GAULD
PM Subject: Re: [Tutor] printing files yes you are right, When i use the following print>>out, handle[1:] In the out file, it saves the lines as a list rather than as a string. How to avoid this. Bala On Thu, Mar 26, 2009 at 7:05 PM, Alan Gauld wrote: "Bala subramanian"

Re: [Tutor] printing files

2009-03-26 Thread Alan Gauld
"Bala subramanian" wrote for files in flist: handle=open(flist).readlines() print>>out, handle print>>out, handle[1:] Should do it? You might need to handle line endings though... Alan G. ___ Tutor maillist - Tutor@python.org http:/

Re: [Tutor] printing files

2009-03-26 Thread Marc Tompkins
On Thu, Mar 26, 2009 at 10:56 AM, Marc Tompkins wrote: > Without changing anything else, you could do it with a slice: > You should probably also close your input files when you're done with them. -- www.fsrtechnologies.com ___ Tutor maillist - Tuto

Re: [Tutor] printing files

2009-03-26 Thread Marc Tompkins
On Thu, Mar 26, 2009 at 10:42 AM, Bala subramanian < bala.biophys...@gmail.com> wrote: >print>>out, handle <-- Here i want to write only from second line. I > dnt want to loop over handle here and putting all lines except the first one > in > anothe

[Tutor] printing files

2009-03-26 Thread Bala subramanian
Friends, My files are like below file1 file2 RemarkRemark --- --- I have huge number of such files. I want to concatenate all files in one huge file. I could do it with a script. But i want to omit the first l

Re: [Tutor] Printing the code of a function

2008-12-29 Thread Kent Johnson
On Sun, Dec 28, 2008 at 8:49 PM, wormwood_3 wrote: > Hello all, > > This might be trivially easy, but I was having a hard time searching on it > since all the component terms are overloaded:-) I am wondering if there is a > way to print out the code of a defined function. If the source code is av

Re: [Tutor] Printing the code of a function

2008-12-29 Thread spir
On Mon, 29 Dec 2008 09:18:43 - "Alan Gauld" wrote: > > "wormwood_3" wrote > > > I am wondering if there is a way to print out the code of a defined > > function. > > Its not reliable but I think you can use > > func.func_code.filename > func.func_code.firstlineno > > To find the first

Re: [Tutor] Printing the code of a function

2008-12-29 Thread Alan Gauld
"wormwood_3" wrote I am wondering if there is a way to print out the code of a defined function. Its not reliable but I think you can use func.func_code.filename func.func_code.firstlineno To find the first line of code in the original source file. Its up to you to figure out the last line

Re: [Tutor] Printing the code of a function

2008-12-28 Thread wormwood_3
kype - shuckins From: bob gailer To: wormwood_3 Cc: tutor@python.org Sent: Sunday, December 28, 2008 9:07:12 PM Subject: Re: [Tutor] Printing the code of a function wormwood_3 wrote: Hello all, This might be trivially easy, but I was having a hard time searching on it since al

Re: [Tutor] Printing the code of a function

2008-12-28 Thread bob gailer
wormwood_3 wrote: Hello all, This might be trivially easy, but I was having a hard time searching on it since all the component terms are overloaded:-) I am wondering if there is a way to print out the code of a defined function. Python does not store the source when compiling thing

Re: [Tutor] Printing the code of a function

2008-12-28 Thread Michiel Overtoom
wormwood_3 wrote: > I am wondering if there is a way to > print out the code of a defined function. When Python compiles source code, it doesn't store the source code itself; only the compiled intermediate code. With the 'dis' package you can disassemble that: def foo(): print "Show me

[Tutor] Printing the code of a function

2008-12-28 Thread wormwood_3
Hello all, This might be trivially easy, but I was having a hard time searching on it since all the component terms are overloaded:-) I am wondering if there is a way to print out the code of a defined function. So if I have: def foo(): print "Show me the money." then I would like to do so

Re: [Tutor] Printing concatenated unicode strings

2008-10-20 Thread Tim Golden
Siim Märtmaa wrote: i would like to do this print u'\u30fa' ヺ with a method like this b = "30fa" uni = u'\u' + b + '\'' but it prints this UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 0-1: end of string in escape sequence so how to concatenate properly to print

[Tutor] Printing concatenated unicode strings

2008-10-20 Thread Siim Märtmaa
Hello i would like to do this >>> print u'\u30fa' ヺ with a method like this b = "30fa" uni = u'\u' + b + '\'' but it prints this UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 0-1: end of string in escape sequence so how to concatenate properly to print the characte

Re: [Tutor] Printing Scripts with color/good formatting

2008-09-14 Thread Omer
I went through a similar process: I got used to PyWin on XP, then when switching to Vista pywin did not install with Python. So I simply downloaded and installed it. (link: http://sourceforge.net/projects/pywin32/ ) Hth, Omer. On Sat, Sep 13, 2008 at 5:41 AM, Mike Meisner <[EMAIL PROTECTED]> wrote

Re: [Tutor] Printing Scripts with color/good formatting

2008-09-13 Thread Alan Gauld
"Mike Meisner" <[EMAIL PROTECTED]> wrote In the XP version, the Python 32-bit editor I'm not sure which editor you mean? Is it Pythonwin? Is there an open-source editor I could use with Vista to get the more attractive, color coded script printout that I get with the 32--bit system? Doe

[Tutor] Printing Scripts with color/good formatting

2008-09-12 Thread Mike Meisner
I've been working with Python on two different machines: under Windows XP and under 64-bit Vista. In the XP version, the Python 32-bit editor prints my scripts using the color coding in the editor and a comfortable to read font. Under Vista 64-bit, only the IDLE environment is available which

Re: [Tutor] printing format with list

2008-01-24 Thread Kent Johnson
Andy Cheesman wrote: > Hi people > > Is there a way to use a list with printf formating without having to > explicitly expanding the list after the % > > e.g > > a = [1, 2, 3] > > print """ Testing > %i, %i, %i """ %(a[0], a[1], a[2]) The argument after % must be a tuple (or a

Re: [Tutor] printing format with list

2008-01-24 Thread Tim Golden
Andy Cheesman wrote: > Hi people > > Is there a way to use a list with printf formating without having to > explicitly expanding the list after the % > > e.g > > a = [1, 2, 3] > > print """ Testing > %i, %i, %i """ %(a[0], a[1], a[2]) > It looks as though string formatting on

[Tutor] printing format with list

2008-01-24 Thread Andy Cheesman
Hi people Is there a way to use a list with printf formating without having to explicitly expanding the list after the % e.g a = [1, 2, 3] print """ Testing %i, %i, %i """ %(a[0], a[1], a[2]) Cheers Andy ___ Tutor maillist - Tut

Re: [Tutor] [tutor] printing bitmap image dynamically reading data inwxpython

2007-10-01 Thread Varsha Purohit
Hi Alan, Thanks for the response. Its not a home work problem its actually a task i need to complete as i am tryin to make some tool which will be helpful to use as a script in arcgis. i kinda got some clue will surely ask help if i get stuck somewhere coz i know its difficult to put down in wor

Re: [Tutor] [tutor] printing bitmap image dynamically reading data inwxpython

2007-10-01 Thread Alan Gauld
"Varsha Purohit" <[EMAIL PROTECTED]> wrote > I want to create a wxpython program where i am reading a list > having > integer values like [1,2,3,4]. and i need to display the output > value as > bitmap image which shd be coloured after reading the values. Like > 1=red, > 2=yellow, 3=orange

[Tutor] [tutor] printing bitmap image dynamically reading data in wxpython

2007-09-30 Thread Varsha Purohit
Hello All, I want to create a wxpython program where i am reading a list having integer values like [1,2,3,4]. and i need to display the output value as bitmap image which shd be coloured after reading the values. Like 1=red, 2=yellow, 3=orange etc and it displays the output in colours at pro

Re: [Tutor] printing value returning from a Class

2007-09-13 Thread Kalle Svensson
Hello! On 9/13/07, Varsha Purohit <[EMAIL PROTECTED]> wrote: > Hello friends,, > I have a problem in displaying data which i have invoked from > class. City is the name of the class which i havent displayed here. There is > another script using that class. It has a function name setCiti

[Tutor] printing value returning from a Class

2007-09-12 Thread Varsha Purohit
Hello friends,, I have a problem in displaying data which i have invoked from class. City is the name of the class which i havent displayed here. There is another script using that class. It has a function name setCities which takes a text file as argument. Text file contains name of the

[Tutor] Printing HTML files

2007-09-10 Thread Gardner, Dean
Hi I am currently trying to print out a html file that is essentially a summary table and I am running into problems. From the link below it seems that the method I am using to print the table doesn't handle column width and wrapping but confusingly we use a similar method elsewhere in the code a

Re: [Tutor] Printing labels

2007-03-07 Thread Tim Golden
Steve Maguire wrote: > I am a Python beginner. For my first task I wanted to fix a program that I > originally wrote in Excel with VBA. I want to create a mySQL database > holding my DVD collection, edit it in Python, and print labels for the > cases > with an index for filing and a catalog of a

[Tutor] Printing labels

2007-03-07 Thread Steve Maguire
I am a Python beginner. For my first task I wanted to fix a program that I originally wrote in Excel with VBA. I want to create a mySQL database holding my DVD collection, edit it in Python, and print labels for the cases with an index for filing and a catalog of all the titles their indices. T

Re: [Tutor] Printing txt files in landscape from python

2007-02-01 Thread Terry Carroll
On Thu, 1 Feb 2007, [ISO-8859-1] J?nos Juh?sz wrote: > do you have any idea, how I can send a txt file to the default printer in > landscape view with python on windows. > I wanted to set up just the char size and the orientation of the printout. I've gotten a crush on wxPython, now that it's ni

Re: [Tutor] Printing txt files in landscape from python

2007-02-01 Thread Tim Golden
> Hi All, > > do you have any idea, how I can send a txt file to the default printer in > landscape view with python on windows. > I wanted to set up just the char size and the orientation of the printout. > > thinking about > os.system('notepad.exe /pt "%%%s"' % filename) Doesn't complete

Re: [Tutor] Printing txt files in landscape from python

2007-02-01 Thread Christopher Arndt
János Juhász schrieb: > do you have any idea, how I can send a txt file to the default printer in > landscape view with python on windows. I assume that by "txt file", you mean a file containing ASCII text? > I wanted to set up just the char size and the orientation of the printout. Printers no

[Tutor] Printing txt files in landscape from python

2007-02-01 Thread János Juhász
Hi All, do you have any idea, how I can send a txt file to the default printer in landscape view with python on windows. I wanted to set up just the char size and the orientation of the printout. thinking about os.system('notepad.exe /pt "%%%s"' % filename) Yours sincerely, ___

Re: [Tutor] printing 00

2006-07-11 Thread Shantanoo Mahajan
+++ Christopher Spears [10-07-06 21:34 -0700]: | I'm working on a problem from "How To Think Like A | Computer Scientist". I created a Time class: | | class Time: | | def __init__(self, hours, minutes, seconds): | self.hours = hours | self.minutes = minut

Re: [Tutor] printing 00

2006-07-10 Thread Danny Yoo
> I created a function to print the Time object: > > def printTime(time): > print "%d:%d:%d" % (time.hours, time.minutes, > time.seconds) > > However, when I type '00', I get the following: time = Time(12,34.4,00) printTime(time) > 12:34:0 Hi Chris, You'll want to check some of th

[Tutor] printing 00

2006-07-10 Thread Christopher Spears
I'm working on a problem from "How To Think Like A Computer Scientist". I created a Time class: class Time: def __init__(self, hours, minutes, seconds): self.hours = hours self.minutes = minutes self.seconds = seconds I created a

Re: [Tutor] printing the links of a page (regular expressions)

2006-05-06 Thread Alfonso
Kent Johnson wrote: > Alfonso wrote: > >> I'm writing a script to retrieve and print some links of a page. These >> links begin wiht "/dog/", so I use a regular expresion to try to find >> them. The problem is that the script only retrieves a link per line in >> the page. I mean, if the line

Re: [Tutor] printing the links of a page (regular expressions)

2006-05-06 Thread Kent Johnson
Alfonso wrote: > I'm writing a script to retrieve and print some links of a page. These > links begin wiht "/dog/", so I use a regular expresion to try to find > them. The problem is that the script only retrieves a link per line in > the page. I mean, if the line hat several links, the script o

[Tutor] printing the links of a page (regular expressions)

2006-05-06 Thread Alfonso
I'm writing a script to retrieve and print some links of a page. These links begin wiht "/dog/", so I use a regular expresion to try to find them. The problem is that the script only retrieves a link per line in the page. I mean, if the line hat several links, the script only reports the first.

Re: [Tutor] Printing the Carriage return character

2006-02-20 Thread Hans Dushanthakumar
ar; tutor@python.org Subject: Re: [Tutor] Printing the Carriage return character >Not sure if this is a python thing or a Operating system > peculiarity, An IDLE thing specifically - or maybe even a Tkinter thing... > Why does the line > print "FirstLine" + "\rSecondLin

Re: [Tutor] Printing the Carriage return character

2006-02-20 Thread Alan Gauld
>Not sure if this is a python thing or a Operating system peculiarity, An IDLE thing specifically - or maybe even a Tkinter thing... > Why does the line > print "FirstLine" + "\rSecondLine" > produce different output when run via IDLE and when run in the python > prompt (both under Windows X

[Tutor] Printing the Carriage return character

2006-02-19 Thread Hans Dushanthakumar
Hi, Not sure if this is a python thing or a Operating system peculiarity, but here goes: Why does the line print "FirstLine" + "\rSecondLine" produce different output when run via IDLE and when run in the python prompt (both under Windows XP)? Output in IDLE (ver 1.1.1, python 2.4.1): >>> print

Re: [Tutor] printing the random seed?

2006-02-02 Thread Kent Johnson
Danny Yoo wrote: > > On Thu, 2 Feb 2006, kevin parks wrote: > > >>Danny (hope you are good!) & co, >> >>I see that biz about random.seed()... but in the absence of setting that >>... does it just grab a value from the system clock? > > > Yes. Here's what the documentation says officially: >

Re: [Tutor] printing the random seed?

2006-02-01 Thread Danny Yoo
On Thu, 2 Feb 2006, kevin parks wrote: > Danny (hope you are good!) & co, > > I see that biz about random.seed()... but in the absence of setting that > ... does it just grab a value from the system clock? Yes. Here's what the documentation says officially: """current system time is also used

Re: [Tutor] printing the random seed?

2006-02-01 Thread kevin parks
Danny (hope you are good!) & co, I see that biz about random.seed()... but in the absence of setting that ... does it just grab a value from the system clock? Is there a way to just let it generate it's usual, known seed... but then observe what that is in case you get an especially good run of

Re: [Tutor] printing the random seed?

2006-02-01 Thread Danny Yoo
> I am having some fun with python and making multiple runs on an > algorhythm and sometimes getting some fun stuff that i would like to be > able to reproduce, but there are some random elements in it. I wonder is > there a way to see the random seed, and make note of it so that you > could then

[Tutor] printing the random seed?

2006-02-01 Thread kevin parks
hi. I am having some fun with python and making multiple runs on an algorhythm and sometimes getting some fun stuff that i would like to be able to reproduce, but there are some random elements in it. I wonder is there a way to see the random seed, and make note of it so that you could then se

[Tutor] Printing in Windows (was: Further help needed!

2006-01-04 Thread Terry Carroll
On Wed, 4 Jan 2006, John Corry wrote: > I am using the following code to send a text file to the printer:- > This code works on windows XP + Windows 2000. However it does not work on > windows 98SE. Here's another alternative, which might be even simpler, if it works for you, invoking the go

[Tutor] Printing in Windows (was: Further help needed!

2006-01-04 Thread Terry Carroll
I've edited the subject line to be a little more clear. On Wed, 4 Jan 2006, John Corry wrote: > I am using the following code to send a text file to the printer:- [ snip ] > This code works on windows XP + Windows 2000. However it does not work on > windows 98SE. Well, at least that narrows

[Tutor] Printing error on Win 98SE

2006-01-02 Thread John Corry
Hi + Happy New Year, With help from several people from the mailing list I have been able to print out text files on my windows XP machine. I have tried using the same program on my windows 98SE machine and I get the following error: PythonWin 2.4.2 (#67, Oct 30 2005, 16:11:18) [MSC v.1310 32 bi

Re: [Tutor] Printing

2005-12-28 Thread Ron Phillips
>>> "John Corry" < [EMAIL PROTECTED] > 12/24/2005 12:28 PM >>>Hi + Season's Greetings!I have put together a program that queries and modifies a Gadfly database.I have captured my output. I now want to print it to paper.I have written the output to a text file. I have searched the tutor mailinglist

Re: [Tutor] Printing

2005-12-27 Thread bob
gt;I have played about with it and saved it in various places but I can't get >it to work. Any suggestions? Do I need to import other modules? Do I need >to use Pythonwin? > >Thanks, > >John. > >-Original Message- >From: [EMAIL PROTECTED] >[mailto:[EMAI

Re: [Tutor] Printing

2005-12-27 Thread Terry Carroll
On Tue, 27 Dec 2005, John Corry wrote: > I am saving the code to c:\python24\jhc2.py > The code creates the file c:\python24\testprint.txt John, I would *very* strongly advise not to store your code in c:\python24 or any subdirectory in it. That is where Python itself lives, and it's very possib

Re: [Tutor] Printing

2005-12-27 Thread Terry Carroll
On Mon, 26 Dec 2005, John Corry wrote: > Thanks for the prompt reply. This is exactly what I am looking for. > However, I have tried the code on the page and I can't get it to work. ... > Traceback (most recent call last): > File "c:\python24\jhc.py", line12, in ? > 0 > pywintypes.error:

Re: [Tutor] Printing

2005-12-26 Thread John Corry
ECTED] [mailto:[EMAIL PROTECTED] Behalf Of Danny Yoo Sent: 24 December 2005 19:33 To: John Corry Cc: Tutor Subject: Re: [Tutor] Printing > I have downloaded win32, win32com, Preppy and PIL. I have had a go at > using them but can't get them to work. At the moment I can't even

Re: [Tutor] Printing

2005-12-24 Thread Kent Johnson
John Corry wrote: > > Hi + Season's Greetings! > > I have put together a program that queries and modifies a Gadfly database. > I have captured my output. I now want to print it to paper. > > I have written the output to a text file. I have searched the tutor mailing > list and used the mailin

Re: [Tutor] Printing

2005-12-24 Thread Danny Yoo
> I have downloaded win32, win32com, Preppy and PIL. I have had a go at > using them but can't get them to work. At the moment I can't even print > the text file. > > Is there a good helpguide/FAQ page which deals with printing text files > or is there simple code which prints a text file? Hi

[Tutor] Printing

2005-12-24 Thread John Corry
Hi + Season's Greetings! I have put together a program that queries and modifies a Gadfly database. I have captured my output. I now want to print it to paper. I have written the output to a text file. I have searched the tutor mailing list and used the mailing list advice to get my data into

Re: [Tutor] Printing regular expression match

2005-12-03 Thread Srinivas Iyyer
Hi Danny, thanks for your email. In the example I've shown, there are no odd elements except for character case. In the real case I have a list of 100 gene names for Humans. The human gene names are conventioanlly represented in higher cases (eg.DDX3X). However, NCBI's gene_info dataset the

Re: [Tutor] Printing regular expression match

2005-12-03 Thread Danny Yoo
On Sat, 3 Dec 2005, Srinivas Iyyer wrote: > >>> a > ['apple', 'boy', 'boy', 'apple'] > > >>> b > ['Apple', 'BOY', 'APPLE-231'] > > >>> for i in a: > pat = re.compile(i,re.IGNORECASE) > for m in b: > if pat.match(m): > print m Hi Srinivas, We may

[Tutor] Printing regular expression match

2005-12-03 Thread Srinivas Iyyer
Dear group, I have two lists: >>> a ['apple', 'boy', 'boy', 'apple'] >>> b ['Apple', 'BOY', 'APPLE-231'] >>> for i in a: pat = re.compile(i,re.IGNORECASE) for m in b: if pat.match(m): print m Apple APPLE-231 BOY

Re: [Tutor] printing statement

2005-11-04 Thread bob
At 10:02 PM 11/3/2005, Johan Geldenhuys wrote: Found it. This is what I was looking for: """ >>> print ('file'+'dir'.center(20))+('\n'+'='*15) file    dir === >>>   """ I am glad you found what you wanted. I'm sad that you did not tell us more precisely what you wanted, as we cou

Re: [Tutor] printing statement

2005-11-03 Thread Johan Geldenhuys
Found it. This is what I was looking for: """ >>> print ('file'+'dir'.center(20))+('\n'+'='*15) file    dir === >>>   """ It's actually a string operator 'center(width)' that I was looking for. I saw the '%', but that is wahat I wanted to use. Johan Colin J. Williams wrote:

Re: [Tutor] printing statement

2005-11-03 Thread Colin J. Williams
bob wrote: >At 11:31 AM 11/3/2005, Johan Geldenhuys wrote: > > >>Hi all, >>Just a quick question; >> >>How do I code this output: >>""" >>files dirs >>== >>""" >> >>I want to print something a few space away from the left side or in the >>middle of the line. >> >> > >In the

Re: [Tutor] printing statement

2005-11-03 Thread bob
At 11:31 AM 11/3/2005, Johan Geldenhuys wrote: >Hi all, >Just a quick question; FWIW saying that does not help. It takes time to read it, and I can judge the question length by reading the question. The real concern is what does it take to construct an answer. _

Re: [Tutor] printing statement

2005-11-03 Thread bob
At 11:31 AM 11/3/2005, Johan Geldenhuys wrote: >Hi all, >Just a quick question; > >How do I code this output: >""" >files dirs >== >""" > >I want to print something a few space away from the left side or in the >middle of the line. In the Python Library Reference look up 2.3.6.2 S

[Tutor] printing statement

2005-11-03 Thread Johan Geldenhuys
Hi all, Just a quick question; How do I code this output: """ files dirs == """ I want to print something a few space away from the left side or in the middle of the line. Thanks, Johan ___ Tutor maillist - Tutor@python.org http://m

Re: [Tutor] printing an acronym (fwd)

2005-09-26 Thread Allen John Schmidt, Jr.
00 From: Jason Massey <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] printing an acronym Something like this: def acro(a): ... b = a.split() ... c = "" ... for d in b: ... c+=d[0].upper() ... return c other than the horrible variable nam

Re: [Tutor] printing an acronym (fwd)

2005-09-26 Thread Danny Yoo
Forwarding to tutor -- Forwarded message -- Date: Mon, 26 Sep 2005 08:32:02 -0500 From: Jason Massey <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] printing an acronym Something like this: def acro(a): ... b = a.split() ... c = &q

Re: [Tutor] printing an acronym

2005-09-24 Thread Danny Yoo
On Sat, 24 Sep 2005 [EMAIL PROTECTED] wrote: > How could I get the following to print out an acronym for each phrase > entered such as if I entered random access memory it word print out RAM? Hello, Just out of curiosity, are you already familiar with Python's "lists"? If so, then you might

Re: [Tutor] printing an acronym

2005-09-24 Thread R. Alan Monroe
> Hello > How could I get the following to print out an acronym for each phrase > entered such as if I entered random access memory it word print out RAM? > import string > def main(): > phrase = (raw_input("Please enter a phrase:")) > acr1 = string.split(phrase) > acr2 = string

[Tutor] printing an acronym

2005-09-24 Thread andrade1
Hello How could I get the following to print out an acronym for each phrase entered such as if I entered random access memory it word print out RAM? import string def main(): phrase = (raw_input("Please enter a phrase:")) acr1 = string.split(phrase) acr2 = string.capwords(phrase

Re: [Tutor] printing documents

2005-05-20 Thread Alan G
> I am writing a program to store name/contact/business transaction > information. I would like the ability to print out a form for each > client with all this stored information. Can somone point me in the > write direction for printing documents. I usually just create html files. PDF would work

[Tutor] printing documents

2005-05-20 Thread Jeff Peery
hello,   I am writing a program to store name/contact/business transaction information. I would like the ability to print out a form for each client with all this stored information.  Can somone point me in the write direction for printing documents. How do I go about setting up a printable page w

Re: [Tutor] printing out a box of O's

2005-03-01 Thread Rainer Mansfeld
Kevin schrieb: I just started getting in to python and for taking a look at the for loop. I want to print out a box of O's 10o chars long by 10 lines long this is what I came up with. Is there a better way to do this: j = 'O' for i in j*10: print i * 100 Thanks Kevin Hi Kevin, I don't know,

Re: [Tutor] printing out a box of O's

2005-02-28 Thread Alan Gauld
- Original Message - From: "Kevin" <[EMAIL PROTECTED]> To: Sent: Tuesday, March 01, 2005 12:35 AM Subject: [Tutor] printing out a box of O's > there a better way to do > this: > > j = 'O' > for i in j*10: > print i * 100 Its not bad,

Re: [Tutor] printing out a box of O's

2005-02-28 Thread Liam Clarke
for y in range(10): for x in range(10): print "O", print '\n' Or - for y in range(10): print "O"*10 On Mon, 28 Feb 2005 18:35:08 -0600, Kevin <[EMAIL PROTECTED]> wrote: > I just started getting in to python and for taking a look at the for > loop. I want to print

[Tutor] printing out a box of O's

2005-02-28 Thread Kevin
I just started getting in to python and for taking a look at the for loop. I want to print out a box of O's 10o chars long by 10 lines long this is what I came up with. Is there a better way to do this: j = 'O' for i in j*10: print i * 100 Thanks Kevin ___

Re: [Tutor] Printing columns of data

2005-02-08 Thread Alan Gauld
> So I wrote the program included below and it only prints the last line > of the file. > I have one question. Do I need to put ts and pe into a list before I > print then to screen or I am just missing something. Thanks. You just need to indent your last print statement so it is inside the loop

Re: [Tutor] Printing columns of data

2005-02-08 Thread Bob Gailer
At 01:03 PM 2/8/2005, Kooser, Ara S wrote: Content-class: urn:content-classes:message Content-Type: multipart/alternative; boundary="_=_NextPart_001_01C50E19.4E45912A" Hello all,    I am writing a program to take a data file, divide it up into columns and print the information back w

Re: [Tutor] Printing columns of data

2005-02-08 Thread Kent Johnson
Kooser, Ara S wrote: Hello all, I am writing a program to take a data file, divide it up into columns and print the information back with headers. The data files looks like this 0.0 -3093.44908 -3084.59762 387.6432926.38518 0.3902434E+00 -0.6024320E-04 0.4529416E-05 1.0 -3

[Tutor] Printing columns of data

2005-02-08 Thread Kooser, Ara S
Title: Printing columns of data Hello all,    I am writing a program to take a data file, divide it up into columns and print the information back with headers. The data files looks like this   0.0 -3093.44908 -3084.59762   387.64329    26.38518  0.3902434E+00 -0.6024320E-04  0.4529416

Re: [Tutor] Printing two elements in a list

2004-12-20 Thread Jacob S.
Duh, whack myself on the head a few times. Thanks, Jacob > Max Noel wrote: > > > > On Dec 19, 2004, at 06:16, Jacob S. wrote: > > > >> Would this work for you? > >> > >> a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA'] > >> for index,thing in enumerate(a): > >> if "Name=

Re: [Tutor] Printing two elements in a list

2004-12-20 Thread Kent Johnson
Max Noel wrote: On Dec 19, 2004, at 06:16, Jacob S. wrote: Would this work for you? a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA'] for index,thing in enumerate(a): if "Name=" in thing: del a[index] A faster way to do this would be to use something like: if thi

Re: [Tutor] Printing two elements in a list

2004-12-20 Thread Max Noel
On Dec 19, 2004, at 06:16, Jacob S. wrote: Would this work for you? a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA'] for index,thing in enumerate(a): if "Name=" in thing: del a[index] I know, that it might be slow, but I thought that maybe it would hold its own bec

Re: [Tutor] Printing two elements in a list

2004-12-19 Thread Jacob S.
Would this work for you? a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA'] for index,thing in enumerate(a): if "Name=" in thing: del a[index] I know, that it might be slow, but I thought that maybe it would hold its own because it doesn't have to import the re modu

Re: [Tutor] Printing two elements in a list

2004-12-07 Thread Liam Clarke
Hi Kumar, I've been studiously avoiding re, and I think you can too for this problem - >I want to remove Name=Xxxx_at identifiers. >My List: >['Name=32972_at', >'Cell1=432\t118\tN\tcontrol\t32972_at\t0\t13\tA\tA\tA\t0\t75952\t-1\t-1\t99\t', >'Cell2=432\t117\tN\tcontrol\t32972_at\t0\t13\tA\tT\t

Removing list elements - was:: [Tutor] Printing two elements in a list

2004-12-07 Thread Alan Gauld
> I know I am wrong here because I do not know how to > search and remove an element in a list. Can any one > please help me. This is what the filter function is for... But you can use list comprehensions too: [element for element in list if element not foo] so in your case: lst = f.readlines(

<    1   2   3   >