Hi,
I want to take read an input file (sels.txt) that looks like:
Begin sels
sel1 = {1001, 1002, 1003, ...
...
1099}
sel2 = {1001, 1008, 1009 ...
...
1299}
End sels
And turn it into an output file for each of the "sels" in the input file,i.e
sel1.txt:
L1001
L1002
L1003
....
L1099
and sel2.txt:
L1001
L1008
L1009
....
L1299
And so on. Many thanks,
Wayne 3 1291
On Jun 20, 10:45 pm, bombe...@aapt.net.au wrote:
Hi,
I want to take read an input file (sels.txt) that looks like:
Begin sels
sel1 = {1001, 1002, 1003, ...
...
1099}
sel2 = {1001, 1008, 1009 ...
...
1299}
End sels
And turn it into an output file for each of the "sels" in the input file, i.e
sel1.txt:
L1001
L1002
L1003
...
L1099
and sel2.txt:
L1001
L1008
L1009
...
L1299
And so on. Many thanks,
Wayne
hehe...
After Bruno's suggested read, go here: http://docs.python.org/tut/
Look at the string module.. specifically .strip() and .split(",")
Also look at reading files and perhaps lists.
for line in open("filename.txt", 'r').readlines():
handle_the_line()
Good Luck.
~Sean
On 2007-06-21, bo******@aapt.net.au <bo******@aapt.net.auwrote:
Hi,
I want to take read an input file (sels.txt) that looks like:
Begin sels
sel1 = {1001, 1002, 1003, ...
...
1099}
sel2 = {1001, 1008, 1009 ...
...
1299}
End sels
And turn it into an output file for each of the "sels" in the input file, i.e
sel1.txt:
L1001
L1002
L1003
...
L1099
and sel2.txt:
L1001
L1008
L1009
...
L1299
And so on. Many thanks,
I think I'd put together a simple grammar and then write a
recursive descent parser that spit out my output files. But
that's just because I find that kind of thing fun. ;)
--
Neil Cerutti
I'm tired of hearing about money, money, money, money, money. I just want to
play the game, drink Pepsi, wear Reebok. --Shaquille O'Neal This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: nieuws |
last post by:
Hi,
I was trying to do the following. It's my first php "project", so it's quiet
logic that i have some problems. Perhaps the php community might help. It's
about this :
I have a txt file...
|
by: Dave |
last post by:
After following Microsofts admonition to reformat my system before doing a
final compilation of my app I got many warnings/errors upon compiling an rtf
file created in word. I used the Help...
|
by: TJ |
last post by:
I am very new to C# (this is my first real project), therefore please be
patient if my question is considered being to newbie.
I am modifying a program which takes a text file, does some...
|
by: Paul |
last post by:
I have looked and looked for this info. All the I/O
examples I've found either explicity use a file name or use
the OpenFileDialog. When you drag a MS Word document over
MS Word, it launches and...
|
by: noopathan |
last post by:
Hi experts ,
I have an excel file in the below format
---------------------------------------------------------------------
CodeID CodeName Market Name Date...
|
by: Vlado Jasovic |
last post by:
Hello,
We're developing application in VS2005 using vb.net.
Our application exe file is ~20mb when compiled.
Recently, we have developed auto-update feature that goes on our web-site,...
|
by: Query Builder |
last post by:
I have one of our production Accounting Databases starting from 2 GB
now grown into a 20 GB Database over the period of a few years...
I have been getting timeouts when transactions are trying to...
|
by: Osoccer |
last post by:
...to a different folder and in the relocated file concatenates all of the lines in one long string with a space between each line element. Here is a fuller statement of the problem:
I need a...
|
by: John Smith |
last post by:
Hi,
I am very new to C# and NET framework. I am trying to hash (using
MD5CryptoServiceProvider) a source that is split into several files.
Now when the source is in one file I can produce the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |