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 is suited to
On Tue, Jun 16, 2009 at 4:27 PM, Essah Mitges e_mit...@hotmail.com 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
Essah Mitges e_mit...@hotmail.com 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 =
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
On Wed, Apr 29, 2009 at 2:42 PM, Dave Crouse dc...@crouse.us 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:
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
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
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
On Thu, Mar 26, 2009 at 10:42 AM, Bala subramanian
bala.biophys...@gmail.com wrote:
printout, 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
another
On Thu, Mar 26, 2009 at 10:56 AM, Marc Tompkins marc.tompk...@gmail.comwrote:
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
___
Bala subramanian bala.biophys...@gmail.com wrote
for files in flist:
handle=open(flist).readlines()
printout, handle
printout, handle[1:]
Should do it? You might need to handle line endings though...
Alan G.
___
Tutor maillist -
Sent: Thursday, 26 March, 2009 6:11:59 PM
Subject: Re: [Tutor] printing files
yes you are right,
When i use the following
printout, 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 alan.ga
On Thu, Mar 26, 2009 at 2:58 PM, ALAN GAULD alan.ga...@btinternet.com 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
printout, handle[1:]
In the out file,
Kent Johnson ken...@tds.net wrote
On Thu, Mar 26, 2009 at 2:58 PM, ALAN GAULD alan.ga...@btinternet.com
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
wormwood_3 wormwoo...@yahoo.com 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
On Mon, 29 Dec 2008 09:18:43 -
Alan Gauld alan.ga...@btinternet.com wrote:
wormwood_3 wormwoo...@yahoo.com 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
On Sun, Dec 28, 2008 at 8:49 PM, wormwood_3 wormwoo...@yahoo.com 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
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
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
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
From: bob gailer bgai...@gmail.com
To: wormwood_3 wormwoo...@yahoo.com
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
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 character ヺ
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
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:
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?
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
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 -
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 only understands
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 single item) so
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 etc and it
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
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
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
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 setCities
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
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.
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 all
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,
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
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 completely answer
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
+++ 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 =
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
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 the details on
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.
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 only
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 hat several
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 XP)?
\r
: 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 + \rSecondLine
produce different output when run via IDLE and when
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
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:
current system
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
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 set
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
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 to
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
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 good
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
"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 and
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: (2,
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
.
-Original Message-
From: [EMAIL PROTECTED]
[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
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 print
the text file.
Is there a good helpguide/FAQ page which deals with printing text files
or is there simple code
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
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 John,
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 mailing list
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
BOY
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 want to change the
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
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 could have steered you
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
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 String Formatting
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.
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 Python Library Reference look up
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:
bob
wrote:
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 =
... for d in b
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 naming, it works.
acro('in
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
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)
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 =
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
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
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
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
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 out a
- Original Message -
From: Kevin [EMAIL PROTECTED]
To: tutor@python.org
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, but the for loop could be 'simplified
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.4529416E-05
1.0
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
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 with
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 and
101 - 190 of 190 matches
Mail list logo