473,763 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

input record seperator (equivalent of "$|" of perl)

Hi,
I know that i can do readline() from a file object.
However, how can I read till a specific seperator?
for exmple,
if my files are

name
profession
id
#
name2
profession3
id2

I would like to read this file as a record.
I can do this in perl by defining a record seperator;
is there an equivalent in python?
thanks

Jul 18 '05
35 2955
Peter Otten wrote:
Reinhold Birkenfeld wrote:
the web: 4%
python: 9%
slashdot: 26%
perl: 29% *


How did you get these data points?


I copied the numbers from these pages:

http://www.google.com/search?q=separate
http://groups-beta.google.com/group/...hon&q=separate
http://www.google.com/search?q=site%...t.org+separate
http://groups-beta.google.com/group/...isc&q=separate

Same thing for the "alternativ e" spelling.


Thanks. A pity that there is no de.comp.lang.py thon, as for German posts
the "Standard/Standart" relation could be more accurate...

or-just-count-the-misplaces-apostrophs-ly yours, Reinhold

--
[Windows ist wie] die Bahn: Man muss sich um nichts kuemmern, zahlt fuer
jede Kleinigkeit einen Aufpreis, der Service ist mies, Fremde koennen
jederzeit einsteigen, es ist unflexibel und zu allen anderen Verkehrs-
mitteln inkompatibel. -- Florian Diesch in dcoulm
Jul 18 '05 #21
Reinhold Birkenfeld wrote:
Peter Otten wrote:
Reinhold Birkenfeld wrote:
the web: 4%
python: 9%
slashdot: 26%
perl: 29% *

How did you get these data points?


I copied the numbers from these pages:

http://www.google.com/search?q=separate
http://groups-beta.google.com/group/...hon&q=separate
http://www.google.com/search?q=site%...t.org+separate
http://groups-beta.google.com/group/...isc&q=separate

Same thing for the "alternativ e" spelling.


Thanks. A pity that there is no de.comp.lang.py thon, as for German posts
the "Standard/Standart" relation could be more accurate...

or-just-count-the-misplaces-apostrophs-ly yours, Reinhold


s/misplaces/misplaced/

just-don't-try-to-write-a-perfect-posting-ly yours!

--
[Windows ist wie] die Bahn: Man muss sich um nichts kuemmern, zahlt fuer
jede Kleinigkeit einen Aufpreis, der Service ist mies, Fremde koennen
jederzeit einsteigen, es ist unflexibel und zu allen anderen Verkehrs-
mitteln inkompatibel. -- Florian Diesch in dcoulm
Jul 18 '05 #22

Steven Bethard wrote:
John Machin wrote:
Nick Coghlan wrote:
[snip]
delimeter.
Hey, Terry, another varmint over here!


No, no. He's talking about a deli-meter. It's the metric standard

for measuring subs and sandwiches. ;)


Nobody mention the wurst! I did once, but I think I got away with it.

Subtle distinction: A metER is a measuring device. A MetRE is a unit of
distance.

Jul 18 '05 #23
John Machin wrote:
Subtle distinction: A metER is a measuring device. A MetRE is a unit of
distance.


.... except in the US, where we stubbornly apply the same spelling to
both of those. (It figures that we Americans just ignore subtle
distinctions... .)

Jeff Shannon
Technician/Programmer
Credit International

Jul 18 '05 #24
John Machin said unto the world upon 2004-12-21 18:20:

Subtle distinction: A metER is a measuring device. A MetRE is a unit of
distance.


Not everyone agrees <http://www.bartleby.co m/61/18/M0251800.html>. I do,
but then I think it ought be spelled 'colour', too.

Best,

Brian vdB
Jul 18 '05 #25
John Machin wrote:
Steven Bethard wrote:
John Machin wrote:
Nick Coghlan wrote:
[snip]
delimeter .

Hey, Terry, another varmint over here!


No, no. He's talking about a deli-meter. It's the metric standard


for
measuring subs and sandwiches. ;)

Nobody mention the wurst! I did once, but I think I got away with it.

Subtle distinction: A metER is a measuring device. A MetRE is a unit of
distance.

So presumably a delimetre is the equivalent of just over three foot-long
subs? And that Monty Python pun was the wurst I've seen this weak.

regards
Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
Jul 18 '05 #26
John Machin wrote:
Nick Coghlan wrote:
[snip]
delimeter.

Hey, Terry, another varmint over here!


Heh. Just don't get me started on the issues I have with typing apostrophes in
the right spot. My *brain* knows where they go, but for some reason it refuses
to let my fingers in on the secret. . .

Cheers,
Nick.

--
Nick Coghlan | nc******@email. com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
Jul 18 '05 #27
On 21 Dec 2004 15:20:35 -0800, rumours say that "John Machin"
<sj******@lexic on.net> might have written:
Subtle distinction: A metER is a measuring device. A MetRE is a unit of
distance.


In this case, English (compared to American English) is closer to the
original "metron" [1]. Now, if only you people wrote the plural of
"parenthesi s" as "parenthese is" and not "parenthese s", that would ease a
lot my Greek English... :)

[1] through the French "mètre" of course; great job, those
revolutionaries did with the metric system. As Asimov put it, "how many
inches to the mile?"
--
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...
Jul 18 '05 #28
Christos "TZOTZIOY" Georgiou <tz**@sil-tec.gr> writes:
[1] through the French "mètre" of course; great job, those
revolutionaries did with the metric system. As Asimov put it, "how many
inches to the mile?"


Trivia question: Name the second most powerfull country on earth not
using the metric system for everything.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jul 18 '05 #29
Mike Meyer:
Trivia question: Name the second most powerfull country on earth not
using the metric system for everything.


The UK?

Before going there I thought they were a fully metric country.
But I saw weather reports in degrees F, distances in yards
and miles, and of course pints of beer.

Andrew
da***@dalkescie ntific.com

Jul 18 '05 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2478
by: Eric Wichterich | last post by:
Hello Pythonistas, does anyone know an equivalent python statement for perl's "next"-statement? (Perl's "next" skips a loop cycle and continues with the next loop cycle - it does not abort the whole loop). Thank you! Eric
1
2742
by: Edward WIJAYA | last post by:
Hi, I am new to Python, and I like to learn more about it. Since I am used to Perl before, I would like to know what is Python equivalent of Perl code below: $filename = $ARGV;
2
3737
by: Dmitry | last post by:
Hello everyone, I have a really simple question here: I have a plain space delimited file that I want to read with WHILE loop 1 line at the time and process each input record as an array of elements. Then, on the next iteration of the loop, clean up the array and populate it with contents of the next input record. Each input record consists of 7 fields / elements separated by spaces. The reason I need this is because I have to switch...
2
1908
by: championsleeper | last post by:
we have a system that recives plain text files from numerous external sources (database and others). our system recieves the information and then processes it. each line in the input file is a record. our system recognizes part of the records by character location (1-6)=date,(7-9)=age etc, parses the record according to the configuration it reads and proceses the data. quite often, the quality of the recieved data is not "good" and we...
5
2519
by: Gregg | last post by:
Hello all, I have been banging my head over a problem that I am having reading a comma seperated file (CSV) that can contain from 1 to 10,000 records. My code snipit is as follows: **Start code snipit** Dim strCustFullName as string Dim strCustAddr1 as string
2
14879
by: lgo | last post by:
I have read several variations of this topic posted on this news group. However I was not able to find the answer for my problem. I am trying to build code (see below) to update a large single record using data from a temporary (editing) table with identical field structure. I iterate through the fields (some 50 of them) with a For Each - Next loop to update each field with the SQL statement. The updating works fine with numeric data type...
21
2915
by: arnuld | last post by:
I have created a program to print the input words on stdout. Input is taken dynamically from stdin. In each word, each input character is allocated dynamically. I have ran this program with a file containing a *single* word made of 25525500 letters and this program works fine on it. I will welcome any suggestions for improvement. /* * A program that will ask the user for input and then will print the words on stdout * and will also...
2
2459
by: sixtyfootersdude | last post by:
Good Morning! I am just starting to learn perl and I am somewhat mistifide about when I should do: print("@input"); and when I should do: print(@input)
0
9563
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9822
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.