wasm-demo/demo/ermis-f/python_m/cur/0193

54 lines
1.4 KiB
Plaintext

From: bhuzyk at kodak.com (Bruce Huzyk)
Date: 14 Apr 1999 13:45:34 GMT
Subject: Converting a string to a tuple
References: <01be8530$65bb7120$52037e81@saints> <14098.28727.245158.616727@buffalo.fnal.gov> <00f501be857f$ff636f40$f29b12c2@pythonware.com> <01be85b5$f7197c90$52037e81@saints> <008f01be85b8$a5be9580$f29b12c2@pythonware.com> <m2emlnn6fj.fsf@mycroft.actrix.gen.nz> <040801be8646$823310d0$f29b12c2@pythonware.com>
Message-ID: <01be8685$52f6c930$52037e81@saints>
X-UID: 193
First let me thank everyone for their help.
Let me take a step back and try to describe my problem with a little more
detail with the disclaimer that I am a little new to Python (but not
programming, BTW I couldn't find the PEWBIE module) and that I am
more of a newsgroup reader then writer so please excuse the fact that this
is my third post.
I will list my solution and ask the question: Is this the way that you
would
implement this?
Any side effects?
E:\PYTHON>type c:\batch\script1.py
import string
fp = open("c:\\test.txt", "r")
s = fp.readline()
s = s[2:]
a = {}
a['1'] = eval(string.replace(s, '\\', '\\\\'))
print type (a['1'])
filename, offset = a['1']
print filename, offset
fp.close
E:\PYTHON>python c:\batch\script1.py
<type 'tuple'>
c:\a\test.txt 1932
E:\PYTHON>type c:\test.txt
:R("c:\a\test.txt",1932)
E:\PYTHON>