Chris Rebert wrote:
> Netiquette comment: Please avoid SHOUTING
>
The brilliant beam of light that first thought
capitilized words amounted to shouting
never programmed cobol, fortran, or pl/1
in the 1960s or 1970s :-)
How or why this behavior was cultivated
and contin
Cathy James, 19.06.2011 01:21:
def fileProcess(filename):
"""Call the program with an argument,
it should treat the argument as a filename,
splitting it up into words, and computes the length of each word.
print a table showing the word count for each of the word lengths
that
On 01/-10/-28163 02:59 PM, Cathy James wrote:
Dear Python Experts,
First, I'd like to convey my appreciation to you all for your support
and contributions. I am a Python newborn and need help with my
function. I commented on my program as to what it should do, but
nothing is printing. I know I
On Sat, Jun 18, 2011 at 4:21 PM, Cathy James wrote:
> Dear Python Experts,
>
> First, I'd like to convey my appreciation to you all for your support
> and contributions. I am a Python newborn and need help with my
> function. I commented on my program as to what it should do, but
> nothing is pri
On 06/18/2011 06:21 PM, Cathy James wrote:
freq = [] #empty dict to accumulate words and word length
While you say you create an empty dict, using "[]" creates an
empty *list*, not a dict. Either your comment is wrong or your
code is wrong. :) Given your usage, I presume you want a di
On Sat, Jun 18, 2011 at 4:21 PM, Cathy James wrote:
> Subject: NEED HELP-process words in a text file
>
> Dear Python Experts,
>
> First, I'd like to convey my appreciation to you all for your support
> and contributions. I am a Python newborn and need help with my
> f
Dear Python Experts,
First, I'd like to convey my appreciation to you all for your support
and contributions. I am a Python newborn and need help with my
function. I commented on my program as to what it should do, but
nothing is printing. I know I am off, but not sure where. Please
help:(
impor
-Original Message-
From: python-list-bounces+shahmed=sfwmd@python.org
[mailto:python-list-bounces+shahmed=sfwmd@python.org] On Behalf Of
Dan M
Sent: Thursday, January 06, 2011 11:06 AM
To: python-list@python.org
Subject: Re: list from FTP server to a text file
On Thu, 06 Jan
On Thu, 06 Jan 2011 10:51:42 -0500, Ahmed, Shakir wrote:
> Hi,
>
> I am trying to create a list in a txt file from an ftp server. The
> following code is retrieving the list of the files but could not able to
> write in a text file. Any help is highly appreciat
Hi,
I am trying to create a list in a txt file from an ftp server. The
following code is retrieving the list of the files but could not able to
write in a text file. Any help is highly appreciated.
Thanks
import os
import time
from ftplib import FTP
ftp = FTP
On Thu, 30 Dec 2010 13:46:35 -0800, harijay wrote:
> Each Thread receives a dynamically generated shell script from some
> classes I wrote and then runs the script using
>
> subprocess.call(["shell_script_file.sh"])
> But I get the same "OSError: [Errno 26] Text
On Thu, 30 Dec 2010 13:46:35 -0800, harijay wrote:
[...]
> But I get the same "OSError: [Errno 26] Text file busy" error
>
> Everytime I run the same job queue a different part of the job fails.
>
> Unfortunately I dont see anybody else reporting this OSError. ANy hel
have dynamically generated and unique filenames
>
> Most often I see references to binary executable files for the error
> message, but I've also seen references to script files, e.g.
> http://www.cyberciti.biz/faq/binbash-bad-interpreter-text-file-busy/
>
>
>
> >
On 12/30/2010 4:46 PM, harijay wrote:
"OSError: [Errno 26] Text file busy" error
Searching 'errno 26', the third Google response suggests that you are
trying to write to a file (especially an executable or shared library?)
that is already in use. Perhaps just trying to r
ynamically generated and unique filenames
Most often I see references to binary executable files for the error
message, but I've also seen references to script files, e.g.
http://www.cyberciti.biz/faq/binbash-bad-interpreter-text-file-busy/
I tested the code on a mac laptop and
og","w")
But I get the same "OSError: [Errno 26] Text file busy" error
Everytime I run the same job queue a different part of the job fails.
Unfortunately I dont see anybody else reporting this OSError. ANy help
in troubleshooting my "newbie" thread cod
On Nov 24, 2:45 pm, Peter Otten <__pete...@web.de> wrote:
> huisky wrote:
> > I see the problem of year. But the question is the source file does
> > NOT provide the year information.
> > for instance if i have one record as ['Dec','6','21:01:17'], and the
> > other as ['Jan','6','21:01:17']
> > th
huisky wrote:
> I see the problem of year. But the question is the source file does
> NOT provide the year information.
> for instance if i have one record as ['Dec','6','21:01:17'], and the
> other as ['Jan','6','21:01:17']
> these two records may be in different year. Will it be a problem to
> u
On Nov 24, 2:09 pm, Peter Otten <__pete...@web.de> wrote:
> huisky wrote:
> > As a newbie, I posted my question here again.
> > say i have two dics read from a text file by 'split'.
>
> Please don't start a new thread when you are still aski
huisky wrote:
> As a newbie, I posted my question here again.
> say i have two dics read from a text file by 'split'.
Please don't start a new thread when you are still asking about the same
topic.
>>>> cstart
>
> defaultdict(, {15424: ['Dec'
On Nov 24, 7:45 am, huisky wrote:
> Hi,
>
> As a newbie, I posted my question here again.
> say i have two dics read from a text file by 'split'.
>
> >>> cstart
>
> defaultdict(, {15424: ['Dec', '6', '18:57:40'], 552:
&g
Hi,
As a newbie, I posted my question here again.
say i have two dics read from a text file by 'split'.
>>> cstart
defaultdict(, {15424: ['Dec', '6', '18:57:40'], 552:
['Dec', '7', '09:31:00'], 15500: ['De
On Nov 1, 6:50 pm, "cbr...@cbrownsystems.com"
wrote:
> On Nov 1, 1:58 am, iwawi wrote:
>
>
>
>
>
> > On 1 marras, 09:59, "cbr...@cbrownsystems.com"
>
> > wrote:
> > > On Oct 31, 11:46 pm, iwawi wrote:
>
> > > > On 31 loka, 21:48, Tim Chase wrote:
>
> > > > > > PRJ01001 4 00100END
> > > > > > P
On Nov 1, 1:58 am, iwawi wrote:
> On 1 marras, 09:59, "cbr...@cbrownsystems.com"
>
>
>
> wrote:
> > On Oct 31, 11:46 pm, iwawi wrote:
>
> > > On 31 loka, 21:48, Tim Chase wrote:
>
> > > > > PRJ01001 4 00100END
> > > > > PRJ01002 3 00110END
>
> > > > > I would like to pick only some columns to a
On 1 marras, 09:59, "cbr...@cbrownsystems.com"
wrote:
> On Oct 31, 11:46 pm, iwawi wrote:
>
>
>
>
>
> > On 31 loka, 21:48, Tim Chase wrote:
>
> > > > PRJ01001 4 00100END
> > > > PRJ01002 3 00110END
>
> > > > I would like to pick only some columns to a new file and put them to a
> > > > certain p
On Oct 31, 11:46 pm, iwawi wrote:
> On 31 loka, 21:48, Tim Chase wrote:
>
>
>
> > > PRJ01001 4 00100END
> > > PRJ01002 3 00110END
>
> > > I would like to pick only some columns to a new file and put them to a
> > > certain places (to match previous data) - definition file (def.csv)
> > > could be
On 31 loka, 21:48, Tim Chase wrote:
> > PRJ01001 4 00100END
> > PRJ01002 3 00110END
>
> > I would like to pick only some columns to a new file and put them to a
> > certain places (to match previous data) - definition file (def.csv)
> > could be something like this:
>
> > VARIABLE FIELDSTARTS
On Oct 31, 12:48 pm, Tim Chase wrote:
> > PRJ01001 4 00100END
> > PRJ01002 3 00110END
>
> > I would like to pick only some columns to a new file and put them to a
> > certain places (to match previous data) - definition file (def.csv)
> > could be something like this:
>
> > VARIABLE FIELDSTARTS
Sorry to clarify, I was having issues getting this to work. I'm relatively new
to Python. Sorry for the miscommunication.
> Date: Sun, 31 Oct 2010 16:13:42 -0500
> From: python.l...@tim.thechases.com
> To: brad...@hotmail.com
> CC: python-list@python.org
> Subject: Re: te
On 10/31/10 14:52, Braden Faulkner wrote:
import csv
f = file('def.csv', 'rb')
f.next() # discard the header row
r = csv.reader(f, delimiter=';')
fields = [
(varname, slice(int(start), int(start)+int(size)), width)
for varname, start, size, width
in r
]
I also am having issues with this.
> Date: Sun, 31 Oct 2010 14:48:09 -0500
> From: python.l...@tim.thechases.com
> To: iwawi...@gmail.com
> Subject: Re: text file reformatting
> CC: python-list@python.org
>
> > PRJ01001 4 00100END
> > PRJ01002 3 00110END
> >
PRJ01001 4 00100END
PRJ01002 3 00110END
I would like to pick only some columns to a new file and put them to a
certain places (to match previous data) - definition file (def.csv)
could be something like this:
VARIABLEFIELDSTARTS FIELD SIZE NEW PLACE IN NEW DATA FILE
ProjID ;
I have this fixed width data file (data.txt) which I would like to
reformat. Data is something like this, with hundreds of rows and
columns, every row finishes to END:
PRJ01001 4 00100END
PRJ01002 3 00110END
PRJ01003 3 00120END
PRJ01004 2 00130END
PRJ01005 1 00140END
PRJ01006 1 00150END
PRJ01007 3
On Sep 9, 10:09 pm, Nobody wrote:
> On Wed, 08 Sep 2010 03:30:00 -0700, Baba wrote:
> > Who is licensed to judge what can and cannot be posted as a question?
>
> Exactly the same set of people who are licensed to judge what can and
> cannot be posted as an answer.
>
> If you don't like the respons
Nobody writes:
> If you don't like the responses you get here, you could try posting your
> questions on 4chan. If nothing else, that will give you a whole new
> perspective on what an "unfriendly" response really looks like.
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 08 Sep 2010 03:30:00 -0700, Baba wrote:
> Who is licensed to judge what can and cannot be posted as a question?
Exactly the same set of people who are licensed to judge what can and
cannot be posted as an answer.
If you don't like the responses you get here, you could try posting your
qu
On 2010-09-09, Ben Finney wrote:
> Grant Edwards writes:
>
>> I'm sure you'd prefer that everything was handed to you for free on a
>> silver platter with a side order of beer and cookies. I'd prefer I was
>> 20 years younger and 30 pounds lighter. Life's tough that way.
>
> Hell no. I'd prefer t
Grant Edwards writes:
> I'm sure you'd prefer that everything was handed to you for free on a
> silver platter with a side order of beer and cookies. I'd prefer I was
> 20 years younger and 30 pounds lighter. Life's tough that way.
Hell no. I'd prefer to have the total of my life experience and
Baba writes:
> Thanks for your feedback. My question is: Who owns this forum? If we
> all do then we are allowed to post questions that are simple and that
> could otherwise be answered by doing research.
That's a rather subservient perspective. Why are you seeking permission
to ask questions? W
On 08/09/2010 23:56, Bar Shirtcliff wrote:
| HEREow can you be learning so much python if you're constantly expressing
typo there. I'm not sure how that happens, sometimes, but it's an
untimely abbrev-expansion, in emacs VM.
I meant to say, "How can you..."
An unkind soul would say that "it'
| HEREow can you be learning so much python if you're constantly expressing
typo there. I'm not sure how that happens, sometimes, but it's an
untimely abbrev-expansion, in emacs VM.
I meant to say, "How can you..."
Cheers,
Bar
--
http://mail.python.org/mailman/listinfo/python-list
| Hi Paul
|
| If i look where i was 4 weeks ago and the progress i made in learning
| Python i am quite delighted. This forum has helped me and i appreciate
| it. I don't think i will ever tell a beginner to "do me a favour" and
| to look things up by himself nor will i use the RTFM line (refering
On 8 sep, 14:39, Paul Rubin wrote:
> Baba writes:
> > But where do you draw the line? Can we not just let people ask
> > questions regardless? And let those answer who want to and those who
> > don't just ignore the question? That seems so much easier to me.
>
> The first few times, it's easy to
Baba a écrit :
"Dear xyz,
Your question can easily be researched online. We suggest you give it
a try and to look it up yourself. This will be beneficial both to you
and to us. We do encourage to ask questions only when they have been
researched first."
On usenet - as well as on most technical
On 2010-09-08, Baba wrote:
> Thanks for your feedback. My question is: Who owns this forum? If we
> all do then we are allowed to post questions that are simple and that
> could otherwise be answered by doing research.
Of course you're allowed to post such questions.
And people are allowed to i
Baba writes:
> But where do you draw the line? Can we not just let people ask
> questions regardless? And let those answer who want to and those who
> don't just ignore the question? That seems so much easier to me.
The first few times, it's easy to ignore the questions. After a few
more times,
On 8 sep, 12:46, Paul Rubin wrote:
> Baba writes:
> > It is just unfriendly
> > to tell someone to go and look it up by themselves.
>
> Someone seeing too many unthoughtful questions from you might tell you
> to look it up yourself, in the hopes of getting you to change your
> questioning style,
Baba writes:
> It is just unfriendly
> to tell someone to go and look it up by themselves.
Someone seeing too many unthoughtful questions from you might tell you
to look it up yourself, in the hopes of getting you to change your
questioning style, so that your future questions will be more though
eve me, documentation
can be offputting too when you only start with programming. Per se the
beauty of forums like these is that there are human beings willing to
make such tasks as finding out how to access a text file less 'scary'.
Whoever thinks he or she has a license to tell someone
Baba writes:
> However the following Wiki excerpt seems to go in my direction:
No, it doesn't. It advises that people show kindness; as I've been
arguing, that's exactly what you were shown. You haven't shown how the
information being imparted could have been fully imparted in a way
that's kinde
On 7 sep, 16:50, Grant Edwards wrote:
> On 2010-09-07, Baba wrote:
>
> > Sloppy wording, I apologise. This should say: If you find the
> > question you're reading too easy then just don't answer. Noone is the
> > owner of a democratic forum where freedom to ask the question one
> > likes is param
On Tue, Sep 7, 2010 at 4:39 AM, Baba wrote:
> On 7 sep, 02:18, Ben Finney wrote:
>> Ben Finney writes:
>> > We value respect for people here, and that's what you've been shown
>> > consistently. But respect for opinions, or for delicacy about
>> > learning, is not welcome here.
>>
>> Sloppy word
On 2010-09-07, Baba wrote:
> Sloppy wording, I apologise. This should say: If you find the
> question you're reading too easy then just don't answer. Noone is the
> owner of a democratic forum where freedom to ask the question one
> likes is paramount (as long of course as it is related to the
>
Baba writes:
> to say "Please do us a favour and at least try to figure things out on
> your own" is in my view inappropriate.
That's what the person wanted you to see. How would you prefer that
exact information to be imparted to you? How could it have been
communicated so that it was not misun
Baba a écrit :
(snip)
If i had
received a friendly response from Benjamin (as opposed to "Please do
us a favor and at least try to figure things out on your own")
According to usenet standards and given your initial question, this is a
_very_ friendly answer.
--
http://mail.python.org/mailman
On 7 sep, 13:39, Baba wrote:
> On 7 sep, 02:18, Ben Finney wrote:
>
>
>
>
>
> > Ben Finney writes:
> > > We value respect for people here, and that's what you've been shown
> > > consistently. But respect for opinions, or for delicacy about
> > > learning, is not welcome here.
>
> > Sloppy wordi
On 7 sep, 02:18, Ben Finney wrote:
> Ben Finney writes:
> > We value respect for people here, and that's what you've been shown
> > consistently. But respect for opinions, or for delicacy about
> > learning, is not welcome here.
>
> Sloppy wording, I apologise. This should say “… is not respect f
Ben Finney writes:
> We value respect for people here, and that's what you've been shown
> consistently. But respect for opinions, or for delicacy about
> learning, is not welcome here.
Sloppy wording, I apologise. This should say “… is not respect for a
person”.
> In other words, we treat peop
Baba writes:
> Thanks Jeremy, i will take your advice on board! Noone likes to be
> taught lessons i think so it is only normal that i reacted.
Please reconsider this response. Many of us use this forum precisely
because we *do* like to be taught lessons. If you don't want to be
taught lessons,
> On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote:
> >> > > > level: beginner
>
> >> > > > how can i access the contents of a text file in Python?
>
> >> > > > i would like to compare a string (word) with the content of a text
> >>
wrote:
>> > > > level: beginner
>>
>> > > > how can i access the contents of a text file in Python?
>>
>> > > > i would like to compare a string (word) with the content of a text
>> > > > file (word_list). i want to see if
On 6 sep, 16:58, Thomas Jollans wrote:
> On Monday 06 September 2010, it occurred to Baba to exclaim:
>
>
>
> > On 6 sep, 00:01, Benjamin Kaplan wrote:
> > > On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote:
> > > > level: beginner
>
> > > >
On Monday 06 September 2010, it occurred to Baba to exclaim:
> On 6 sep, 00:01, Benjamin Kaplan wrote:
> > On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote:
> > > level: beginner
> > >
> > > how can i access the contents of a text file in Python?
> > >
On 6 sep, 00:04, Seth Rees wrote:
> On 09/05/10 16:47, Baba wrote:
>
> > level: beginner
>
> > how can i access the contents of a text file in Python?
>
> > i would like to compare a string (word) with the content of a text
> > file (word_list). i want to see i
On 6 sep, 00:01, Benjamin Kaplan wrote:
> On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote:
> > level: beginner
>
> > how can i access the contents of a text file in Python?
>
> > i would like to compare a string (word) with the content of a text
> > file (word_l
Em 05-09-2010 19:06, Alexander Kapps escreveu:
> Baba wrote:
>> level: beginner
>>
>> how can i access the contents of a text file in Python?
>>
>> i would like to compare a string (word) with the content of a text
>> file (word_list). i want to see if wo
Baba wrote:
level: beginner
how can i access the contents of a text file in Python?
i would like to compare a string (word) with the content of a text
file (word_list). i want to see if word is in word_list. let's assume
the TXT file is stored in the same directory as the PY file.
On 05/09/2010 22:47, Baba wrote:
level: beginner
how can i access the contents of a text file in Python?
That's a very basic question.
I suggest you read a tutorial such as "Dive Into Python":
http://diveintopython.org/toc/index.html
i would like to compare a string
On Sun, Sep 5, 2010 at 5:47 PM, Baba wrote:
> level: beginner
>
> how can i access the contents of a text file in Python?
>
> i would like to compare a string (word) with the content of a text
> file (word_list). i want to see if word is in word_list. let's assume
> the
On 09/05/10 16:47, Baba wrote:
> level: beginner
>
> how can i access the contents of a text file in Python?
>
> i would like to compare a string (word) with the content of a text
> file (word_list). i want to see if word is in word_list. let's assume
> the TXT
may be something like this
f = open ("file",r)
data = f.read()
f.close
if word in data:
print word, "is present in file"
On Mon, Sep 6, 2010 at 3:17 AM, Baba wrote:
> level: beginner
>
> how can i access the contents of a text file in Python?
>
> i w
level: beginner
how can i access the contents of a text file in Python?
i would like to compare a string (word) with the content of a text
file (word_list). i want to see if word is in word_list. let's assume
the TXT file is stored in the same directory as the PY file.
def is_valid_word
On Jun 21, 5:13 pm, Stephen Hansen wrote:
> On 6/21/10 4:26 PM, davidgp wrote:
>
>
>
>
>
> > ah, i see :P
> > float("45.34") or whatever does work fine, but the problem is that i'm
> > reading it from a text file. so somehow it is not a real str
On 6/21/10 4:26 PM, davidgp wrote:
> ah, i see :P
> float("45.34") or whatever does work fine, but the problem is that i'm
> reading it from a text file. so somehow it is not a real string or
> whatever..
> here's a part of the code:
> f = open ('/home/da
found')
Traceback (most recent call last):
File "", line 1, in
ValueError: invalid literal for float(): not found
--
Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog:http://meh.ixokai.io/
signature.asc
< 1KViewDownload
ah, i see
quot;line", for whatever reason, contains the string "not found", as in:
>
> >>> float('not found')
>
> Traceback (most recent call last):
> File "", line 1, in
> ValueError: invalid literal for float(): not found
>
> --
>
&g
On 6/21/10 4:03 PM, davidgp wrote:
>
> sorry :)
Okay, I should be more specific: include full tracebacks and some real
copied and pasted code :) Don't throw away nice debugging information
Python gave you, feed it to us.
> invalid literal for long() with base 10: '51.9449702'
> this is the error
On Jun 21, 4:00 pm, Stephen Hansen wrote:
> On 6/21/10 3:54 PM, davidgp wrote:
>
> > i basically tried this:
> > lat =0.0
> > for line in f:
> > lat = float(line)
>
> > but this gives an error.. does anyone know what i should to do?
> > thanks,
>
> "An error"?
>
> Python 2.6.1 (r261:67515, Feb 1
On 6/21/10 3:54 PM, davidgp wrote:
> i basically tried this:
> lat =0.0
> for line in f:
> lat = float(line)
>
> but this gives an error.. does anyone know what i should to do?
> thanks,
"An error"?
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
hello,
i have a text file that contains gps coordinates that i want to load
into my mysql database
the file is basically in this format:
52.2375412
5.1802704
i basically tried this:
lat =0.0
for line in f:
lat = float(line)
but this gives an error.. does anyone know what i should to do?
thanks
On 06/09/2010 05:27 AM, hiral wrote:
On Jun 6, 7:27 am, Steve wrote:
On 5 June, 08:53, Steve wrote:
Remove all comma's
Replace all @ with comma's
Save as a new file.
Many thanks for your suggestions.
sed -i 's/Hello/hello/g' file
Run twice on the CL..with the hello's changed for my needs
On Jun 6, 7:27 am, Steve wrote:
> On 5 June, 08:53, Steve wrote:
>
> > I am new to Python and am wanting to replace characters in a very
> > large text file.6 GB
> > In plain language what I wish to do is:
>
> > Remove all comma's
> > Repla
On Sat, 05 Jun 2010 16:35:42 +0100, MRAB wrote:
>>> In plain language what I wish to do is:
>>>
>>> Remove all comma's
>>> Replace all @ with comma's
>> input_file = open("some_huge_file.txt", "r")
>> output_file = open("newfilename.txt", "w")
>> for line in input_file:
> I'd probably process it
On Sat, Jun 5, 2010 at 1:23 PM, Steve wrote:
>
> Remove all comma's
> Replace all @ with comma's
> Save as a new file.
>
Why don't you use 'sed'. It'd be way faster
--
Eknath Venkataramani
--
http://mail.python.org/mailman/listinfo/python-list
On 5 June, 08:53, Steve wrote:
> I am new to Python and am wanting to replace characters in a very
> large text file.6 GB
> In plain language what I wish to do is:
>
> Remove all comma's
> Replace all @ with comma's
> Save as a new file.
>
> Any of you
Steven D'Aprano wrote:
On Sat, 05 Jun 2010 00:53:23 -0700, Steve wrote:
I am new to Python and am wanting to replace characters in a very large
text file.6 GB
In plain language what I wish to do is:
Remove all comma's
Replace all @ with comma's
Save as a new file.
in
A module designed to do this is fileinput:
http://docs.python.org/library/fileinput.html
The approach is the same as the other except that it's in the standard
library.
2010/6/5 Paul Rubin
> Steve writes:
> > Remove all comma's
> > Replace all @ with comma's
> > Save as a new file.
>
> The si
Steve writes:
> Remove all comma's
> Replace all @ with comma's
> Save as a new file.
The simplest way is just copy the file one character at a time, making
replacements to commas and @'s as stated. That will be a bit slow
(especially in Python) but if you only have to do it once, just wait it
o
On Sat, 05 Jun 2010 00:53:23 -0700, Steve wrote:
> I am new to Python and am wanting to replace characters in a very large
> text file.6 GB
> In plain language what I wish to do is:
>
> Remove all comma's
> Replace all @ with comma's
> Save as
On Apr 17, 11:05 am, Peter Otten <__pete...@web.de> wrote:
>
> Just in case you didn't know:
>
> for line in instream:
> ...
>
> looks better, uses less memory, and may be a tad faster than
>
> for line in instream.readlines():
> ...
>
> Peter
Thanks for your suggestions, t
Alessio wrote:
> I used readlines() to read my text file, then with a for cicle I
> extract line by line the substrings I need by regular expressions
Just in case you didn't know:
for line in instream:
...
looks better, uses less memory, and may be a tad faster than
Alessio, 17.04.2010 10:19:
I used readlines() to read my text file, then with a for cicle I
extract line by line the substrings I need by regular expressions
(re.findall())
Note that it's usually more efficient to just run the for-loop over the
file object, rather than using readlines()
On Apr 15, 3:25 pm, Neil Cerutti wrote:
> On 2010-04-15, Alessio wrote:
>
> > Hi,
>
> > I'm facing the problem in the subject:
> > - I have a text file that I need to parse for producing a specifical
Thank you, I forgot to say that I already solved.
I used readli
On 2010-04-15, Alessio wrote:
> Hi,
>
> I'm facing the problem in the subject:
> - I have a text file that I need to parse for producing a specifical
> string (Json like) extracting some information (substring) in it;
> - I created regural expressions capable to locate t
Hi,
I'm facing the problem in the subject:
- I have a text file that I need to parse for producing a specifical
string (Json like) extracting some information (substring) in it;
- I created regural expressions capable to locate these substrings in
my txt file;
now I don't know how t
On Feb 26, 6:19 pm, ru...@yahoo.com wrote:
> On Feb 26, 2:21 pm, qtrimble wrote:
>
>
>
> > On Feb 26, 4:14 pm, OdarR wrote:
> >
> > > > below is just a sample. There are well over 500,000 lines that need
> > > > processed.
>
> > > > wer1999001
> > > > 31.2234 82.2367
> > > > 37
I smell homework
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 26, 2:21 pm, qtrimble wrote:
> On Feb 26, 4:14 pm, OdarR wrote:
>
> > > below is just a sample. There are well over 500,000 lines that need
> > > processed.
>
> > > wer1999001
> > > 31.2234 82.2367
> > > 37.9535 82.3456
> > > wer1999002
> > > 31.2234 82.2
On 2/26/2010 4:21 PM, qtrimble wrote:
fileIN = open(r"C:\testing.txt", "r")
for line in fileIN:
year = line[3:7]
day = line[7:10]
print year, day
This is good since i can get the year and day of year into a variable
but I haven't gotten any further.
That's an excellent start.
On Feb 26, 4:14 pm, OdarR wrote:
> On 26 fév, 22:08, qtrimble wrote:
>
>
>
> > I'm a python newbie but I do have some basic scripting experience. I
> > need to take the line starting with "wer" and extract the year and day
> > of year from that string. I want to be able to add the year and day
301 - 400 of 1034 matches
Mail list logo