thanks dan
On Jun 13, 2006, at 8:15 AM, Daniel Lewis wrote:
Buddy,
Please read the Python tutorial as distributed with Python. It
addresses this very issue in
one section.
May I also suggest picking up a "python for beginners" book to use
as a reference?
I had many of these questions when I first started writing Python a
few years ago and these
references were (and continue to be) indispensable...
Dan
Dan Lewis
Assistant Professor
Materials Research Center, Room 110
Rensselaer Polytechnic Institute
http://www.rpi.edu/~lewisd2
On Jun 13, 2006, at 6:13 AM, Damm, Edward F. (E. Buddy) wrote:
Hi, I'm trying to append computed values to an output file at
defined solution intervals. All the documentation and tutorials
on python seem to write charachter strings instread of computed
values.
Here is a test case. Anyone have some tips on what to replace "
'Here I want the VALUES of t, r, l and d, but only can seem to get
a single string to work like this one!' " with to get the values
of t, r, l and d?
>>>t=0
>>>logfile = open('log.dat', 'w') # opens a file to write to
>>>logfile.write('t, r, l, d' "\n") #Hooray, this works, I
get a header!
>>>logfile.close() # should I leave it open for efficiency?
>>>while t<10:
>>> r=t-1*123
>>> l=342/r
>>> d=(87-r)*l
>>> t = t+1
>>> logfile = open('log.dat','a') # the 'a' allows you to
append to your file
>>> logfile.write('Here I want the VALUES of t, r, l and d, but
only can seem to get a single string to work like this one!' "\n")
>>>logfile.close()
Thanks in advance!
Buddy
This message and any attachments are intended for the individual or
entity named above. If you are not the intended recipient, please
do not forward, copy, print, use or disclose this communication to
others; also please notify the sender by replying to this message,
and then delete it from your system. The Timken Company / The
Timken Corporation
Dr. James A. Warren
Leader, Thermodynamics and Kinetics Group, Metallurgy Division
Materials Science and Engineering Laboratory
National Institute of Standards and Technology
Adjunct Professor, Inst. for Physical Science and Technology, U.
Maryland
Contact Information:
NIST email:[EMAIL PROTECTED]
100 Bureau Drive, Stop 8554 WWW:http://www.ctcms.nist.gov/
~jwarren
Gaithersburg, MD 20899-8554 Phone: (301)975-5708/FAX:(301)
975-4553