Gabriel Genellina wrote:
> En Thu, 15 Mar 2007 18:31:29 -0300, Ritesh Raj Sarraf <[EMAIL PROTECTED]>
> escribió:
>
>> I'm not sure if there's something wrong in the code mentioned above or
>> is it
>> really a lock problem.
>
> Try to break the code into smaller pieces to see what is wrong. It's
On Mar 16, 12:49 am, "n00m" <[EMAIL PROTECTED]> wrote:
> for o in range(int(f.readline())):
> row = map(int, f.readline().split())
> q.append(row[0])
> w.append(row[1])
> e.append(row[2])
> r.append(row[3])
Does this help at all in reading in your data?
numlines = f.readline()
rows = [
Leo Kislov wrote:
> You're changing environmental variable __kabc_ldap that is shared
> between your threads. Environment is not designed for that kind of
> usage, it was designed for settings. Either use an option to set
> output file or just redirect stdout. If the interface of ldapsearch is
> s
In <[EMAIL PROTECTED]>, Paul Rubin wrote:
> "n00m" <[EMAIL PROTECTED]> writes:
>> h = collections.defaultdict(itertools.repeat(0).next)
>
> Something wrong with
>h = collections.defaultdict(int)
> ?
According to a post by Raymond Hettinger it's faster to use that iterator
instead of `in
On Mar 16, 12:40 am, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote:
> Leo Kislov wrote:
> > You're changing environmental variable __kabc_ldap that is shared
> > between your threads. Environment is not designed for that kind of
> > usage, it was designed for settings. Either use an option to set
> >
or go to
http://pythonmac.org/packages/
and you have python 2.5 or python 2.4.4 with readline support
--
http://mail.python.org/mailman/listinfo/python-list
On 16 Mar, 03:56, "hiro" <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I'm very new to python, the problem I need to solve is whats the "best/
> simplest/cleanest" way to read in multiple files (ascii), do stuff to
> them, and write them out(ascii).
>
> --
> import os
>
> filePath = ('O:/spam/eggs/')
On 16 Mar, 09:02, "Jon Clements" <[EMAIL PROTECTED]> wrote:
> On 16 Mar, 03:56, "hiro" <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi there,
>
> > I'm very new to python, the problem I need to solve is whats the "best/
> > simplest/cleanest" way to read in multiple files (ascii), do stuff to
> > them,
In article <[EMAIL PROTECTED]>, alf <[EMAIL PROTECTED]> wrote:
>Hi,
>
>I have a small app which consist of a few .py files. Is there any way to
>distribute it in jar like fashion as a single file I can just run python
>on. I obviously look for platform independent solution.
>
>Thx in advance, A.
On Wed, 14 Mar 2007 07:59:57 -0500
[EMAIL PROTECTED] wrote:
#>
#> Slawomir> When I execfile a file which contains a syntax error, the file
#> Slawomir> becomes locked and stays this way all the way until I exit the
#> Slawomir> interpreter (I am unable to delete it, for example). I ha
for anyone who gets this same problem i managed to resolve the issue
using two threads.
The main program spawned a subprocess and used readlines to read the
output. The process spawned was a script which executes a command using
a thread. The thread reads the output from this command using readline
Hi Group,
If I have a CSV reader that's passed to a function, is it possible for
that function to retrieve a reference to the "fileobj" like object
that was passed to the reader's __init__? For instance, if it's using
an actual file object, then depending on the current row, I'd like to
open the f
I am new to python and programming generally, but someday it is time
to start :)
I am writing a python module in C and have a question about multibyte
character strings in python<=>C.
I want a C function which takes a string as argument from python
script:
static PyObject *
connect_to_server(PyObj
Can a object sharable by two different python programs... If so can you please
explain... because my project needs two programs to access nearly 45GB file
Symentaniously...
By
Clement Jeba kumar,
Tenkasi.
-
It's here! Your new message!
Get new email alerts
Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my
curriculum did not include Python programming yet I see many vacancies
for Python developers.I studied programming Pascal,C++ and Delphi.So I
need to catch up quickly and master Python programming.How do you
suggest that I achieve this g
William Hudspeth <[EMAIL PROTECTED]> wrote:
> [ ... ] I need to pass multiple filenames to an
>executable. The filenames are similar to one another, but differ only
>slightly, hence the use of the wildcard. The executable works well from
>the command line if I pass in a wildcard filename, but Pope
Alex Martelli wrote:
> Steve Holden <[EMAIL PROTECTED]> wrote:
>...
Get yourself a stuffed bear, and next time you have this kind of problem
spend a few minutes explaining to the bear exactly how your program
can't possibly be wrong. Works like a charm.
>>> A rubber ducky works m
It is just a good news.
--
http://mail.python.org/mailman/listinfo/python-list
Maybe the walk method in os module is what you need
http://docs.python.org/lib/os-file-dir.html
Regards
Jon Clements wrote:
> On 16 Mar, 09:02, "Jon Clements" <[EMAIL PROTECTED]> wrote:
>> On 16 Mar, 03:56, "hiro" <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>
>>
>> > Hi there,
>>
>> > I'm very new to p
I wonder is there any way to make the wrapper program can wrap options
&& arguments for the the subprocess/command the wrapper will
execute? by getopt or optparse module?
This is something like the shell script like this:
optwrap=""
while [ $# -gt 0 ]; do
case $1 in
-a) do-something; s
Kazu,
On Thu, Mar 15, 2007 at 05:33:29PM -0700, Kazu Nisimura wrote:
> >>> import MySQLdb
> Traceback (most recent call last):
> File "", line 1, in ?
> File "build/bdist.cygwin-1.5.22-i686/egg/MySQLdb/__init__.py", line
> 19, in ?
> File "build/bdist.cygwin-1.5.22-i686/egg/_mysql.py", line
On Mar 16, 7:09 am, Laurent Rahuel <[EMAIL PROTECTED]> wrote:
> Maybe the walk method in os module is what you
> needhttp://docs.python.org/lib/os-file-dir.html
>
> Regards
>
> Jon Clements wrote:
> > On 16 Mar, 09:02, "Jon Clements" <[EMAIL PROTECTED]> wrote:
> >> On 16 Mar, 03:56, "hiro" <[EMAIL
Jon> If I have a CSV reader that's passed to a function, is it possible
Jon> for that function to retrieve a reference to the "fileobj" like
Jon> object that was passed to the reader's __init__?
Nope, that isn't exposed from the C type.
Skip
--
http://mail.python.org/mailman/listin
Hello alltogether,
is it possible to format stings with fixed width of let's say 7 character. T
need a floating point with 3 chars before dot, padded with ' ' and 3 chars
after
dot, padded with '0'.
Followingh is my approach
>>> f = 21.1
>>> s = "%.03f" % f
>>> s
'21.100'
But there are mis
Hello alltogether,
is it possible to format stings with fixed width of let's say 7 character. T
need a floating point with 3 chars before dot, padded with ' ' and 3 chars
after
dot, padded with '0'.
Followingh is my approach
>>> f = 21.1
>>> s = "%.03f" % f
>>> s
'21.100'
But there are mis
In <[EMAIL PROTECTED]>, Gerald wrote:
> Can you recommend websites that feature a gentle introduction to Python?
If you already know programming in general, `Dive Into Python`_ might be a
good starting point. And of course the tutorial in the Python
documentation.
_Dive Into Python: http://www.
n00m wrote:
> 62.5030784639
Maybe this one could save a few seconds, it works best when there are
multiple occurrences of the same value.
A.
from time import time
def freq(L):
D = {}
for x in L:
D[x] = D.get(x,0)+1
return D
def test():
t = time()
f = fil
Gerald a écrit :
> Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my
> curriculum did not include Python programming yet I see many vacancies
> for Python developers.I studied programming Pascal,C++ and Delphi.So I
> need to catch up quickly and master Python programming.How do you
> su
Alexander Eisenhuth wrote:
> Hello alltogether,
>
> is it possible to format stings with fixed width of let's say 7 character. T
> need a floating point with 3 chars before dot, padded with ' ' and 3 chars
> after
> dot, padded with '0'.
>
> Followingh is my approach
> >>> f = 21.1
> >>> s =
Greetings,
First I will admit I am new to Python but have experience with C++ and
some Tcl/Tk. I am starting to use a tool called MaxQ that uses
jython. I have been studying Rossum's tutorial but still am unclear on
importing, the use of self, and calling functions with their own name
in quotes.
On 16 Mar, 13:20, Alexander Eisenhuth <[EMAIL PROTECTED]>
wrote:
> Hello alltogether,
>
> is it possible to format stings with fixed width of let's say 7 character. T
> need a floating point with 3 chars before dot, padded with ' ' and 3 chars
> after
> dot, padded with '0'.
>
> Followingh is my a
Jon Clements a écrit :
> Hi Group,
>
> If I have a CSV reader that's passed to a function, is it possible for
> that function to retrieve a reference to the "fileobj" like object
> that was passed to the reader's __init__? For instance, if it's using
> an actual file object, then depending on the
On Mar 16, 6:41 am, "Gerald" <[EMAIL PROTECTED]> wrote:
> Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my
> curriculum did not include Python programming yet I see many vacancies
> for Python developers.I studied programming Pascal,C++ and Delphi.So I
> need to catch up quickly and ma
On Mar 16, 6:41 am, "Gerald" <[EMAIL PROTECTED]> wrote:
> Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my
> curriculum did not include Python programming yet I see many vacancies
> for Python developers.I studied programming Pascal,C++ and Delphi.So I
> need to catch up quickly and ma
On Mar 13, 2:16 am, Steven D'Aprano <[EMAIL PROTECTED]>
wrote:
> I'd be interested in hearing people's stories of Eureka moments in Python,
> moments where you suddenly realise that some task which seemed like it
> would be hard work was easy with Python.
>
The day I wrote a CORBA method intercept
Steve Holden wrote:
> Alexander Eisenhuth wrote:
>> Hello alltogether,
>>
>> is it possible to format stings with fixed width of let's say 7 character. T
>> need a floating point with 3 chars before dot, padded with ' ' and 3 chars
>> after
>> dot, padded with '0'.
>>
>> Followingh is my approac
On Fri, 2007-03-16 at 04:04 -0700, Yury wrote:
> I am new to python and programming generally, but someday it is time
> to start :)
> I am writing a python module in C and have a question about multibyte
> character strings in python<=>C.
> I want a C function which takes a string as argument from
Thanks for your fast reply. I'm fine with your "%7.03f" solution. (negatives
are
not significant)
Alexander Eisenhuth schrieb:
> Hello alltogether,
>
> is it possible to format stings with fixed width of let's say 7
> character. T need a floating point with 3 chars before dot, padded with
>
On Mar 16, 8:39 am, "Paul McGuire" <[EMAIL PROTECTED]> wrote:
[...]
> Stop thinking about *how* to start and *just start*. Python is pretty
Indeed. Of all the fortune cookies I've eaten over the years, I've
saved (and taped to my monitor) only one fortune. It reads:
Begin...the rest is easy.
On Mar 16, 8:39 am, "Paul McGuire" <[EMAIL PROTECTED]> wrote:
>
> Wow, are you still reading? Quit wasting time and go download a
> Python dist and get started already!
>
I think you should extract that and spend twenty minutes tidying it up
and then publish it to the Python for Programmers page
HMS Surprise a écrit :
> Greetings,
>
> First I will admit I am new to Python but have experience with C++ and
> some Tcl/Tk. I am starting to use a tool called MaxQ that uses
> jython. I have been studying Rossum's tutorial but still am unclear on
> importing,
What's your problem here ?
> the
Paul McGuire schrieb:
> What does Python have that C++ doesn't?
> - The biggie: dynamic typing (sometimes called "duck typing").
> Dynamic typing is a huge simplifier for development:
> . no variable declarations
> . no method type signatures
> . no interface definitions needed
> . no templ
Larry,
It's been a while since I coded something in VB or Delphi because I'm mostly
turn on Python ;)
so please excuse me any mistakes I can make 8I don't have neither VB or
Delphi installed on this computer)
For Delphi to use an OLE/COM Object it requires a TypeLibrary that explains
how to acc
try google: "python apack" found several
in general, always google first; python has so many devotees that someone
has generally solved most problems already.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Behalf Of priya kale
Sent: Thursday, March 15, 2007 11:33 PM
Gerald wrote:
> Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my
> curriculum did not include Python programming yet I see many vacancies
> for Python developers.I studied programming Pascal,C++ and Delphi.So I
> need to catch up quickly and master Python programming.How do you
> sugge
Whats this got to do with python?
On Jan 19, 9:34 pm, [EMAIL PROTECTED] wrote:
> Coz we have fools in the govt, the downfall of the US has only been
> accelerated !!
> The are morons who staged 9/11 controlled demolition to kill americans
> to start their idiotic war.
>
> Date: Sat, 21 Oct 2006 1
Ben Finney napisał(a):
>> I'd be interested in hearing people's stories of Eureka moments in
>> Python, moments where you suddenly realise that some task which
>> seemed like it would be hard work was easy with Python.
>
> I don't recall the exact context, but Python was the language that
> intro
On Mar 16, 4:08 am, [EMAIL PROTECTED] (Alex Martelli) wrote:
> Bert Heymans <[EMAIL PROTECTED]> wrote:
> > Hi!
>
> > I'm using iTerm on the mac the keymapping isn't right. On Linux and
> > Windows it's really nice to be able to hit up to get the previous
> > command. Does anyone know a way to get t
I want to sendmessages to a upnp device ,and listen to it's
notify messages. Can I do that with Python. Can you help me and
send an example?
Thanks
Ozan
--
http://mail.python.org/mailman/listinfo/python-list
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Paul Rubin wrote:
>
>> "n00m" <[EMAIL PROTECTED]> writes:
>>> h = collections.defaultdict(itertools.repeat(0).next)
>> Something wrong with
>>h = collections.defaultdict(int)
>> ?
>
> According to a post by Raymond Hettinger it's
The general idiom for altering lines in a file is to open the original
file and write the alterations to a temp file. After you are done
writing to the temp file, delete the original file, and change the
temp file name to the original file name.
If instead you were to read the whole file into a va
I am seeing different outcomes from simple requests against a common database
when run from a freebsd machine and a win32 box.
The test script is
###
import MySQLdb, sys
print sys.version
print MySQLdb.__version__
db=MySQLdb.connect(host='appx',db='sc_0',user='user',passwd='s
Steven Bethard <[EMAIL PROTECTED]> writes:
> > According to a post by Raymond Hettinger it's faster to use that
> > iterator instead of `int`.
> Yep. It's because the .next() method takes no arguments, while int()
> takes varargs because you can do:: ...
Heh, good point. Might be worth putting a
Were Python "eggs" a flop, or what?
We need to have one packager that everyone agrees on.
Otherwise, installs become a mess, and then you have to have
installers that handle multiple packagers.
John Nagle
Gary Duzan wrote:
> In article <[EMAIL PR
On Mar 16, 9:38 am, "7stud" <[EMAIL PROTECTED]> wrote:
> -
> import os
>
> filepath = "./change_files"
>
> li = os.listdir(filepath)
> for name in li:
> fullpath = filepath + "/" + name
> if os.path.isfile(fullpath):
> infile = open(fullpath, 'r')
>
>
yep, thanx a lot ;)
2007/3/15, hg <[EMAIL PROTECTED]>:
Paul Rubin wrote:
> tlslite
cool !
--
http://mail.python.org/mailman/listinfo/python-list
--
Pınar "pinguar" Yanardağ
http://pinguar.org
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for posting. I continued to read and realized the instantiation
was not a function call soon after I posted. Oh well...
Still unsure about the best way to break up the large #start - #end
section. I appreciate your answers and try to digest them more fully.
Then maybe I will have a better i
Dennis Lee Bieber wrote:
> On 16 Mar 2007 04:41:38 -0700, "Gerald" <[EMAIL PROTECTED]> declaimed
> the following in comp.lang.python:
>
>> Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my
>> curriculum did not include Python programming yet I see many vacancies
>> for Python develope
Paul McGuire <[EMAIL PROTECTED]> wrote:
>On Mar 13, 2:16 am, Steven D'Aprano <[EMAIL PROTECTED]>
>wrote:
>> I'd be interested in hearing people's stories of Eureka moments in Python,
>> moments where you suddenly realise that some task which seemed like it
>> would be hard work was easy with Python
Rocky Zhou wrote:
> I wonder is there any way to make the wrapper program can wrap options
> && arguments for the the subprocess/command the wrapper will
> execute? by getopt or optparse module?
[snip]
> I need this because I now have finished a fs_backup script written in
> python, it will execu
Hi!
I work for a company located in Barcelona, Spain, and we are
looking for an on-site introductory Python training. The
audience would consist of about 10 developers with Java
background. The training should be taught in Spanish.
Does anyone knows of a company or individual that could
deliver
Hello everyone!
i have the following test code:
class temp:
def __init__(self):
self.hello = "hello world!"
def printworld(self):
print(self.hello)
t = temp()
and i tried to call profile('t.printworld()')
but i received the following error:
Traceback (most recent call last
I have an ordered list e.g. x = [0, 100, 200, 1000], and given any
positive integer y, I want to determine its appropriate position in
the list (i.e the point at which I would have to insert it in order to
keep the list sorted. I can clearly do this with a series of if
statements:
if yx[i] for i i
You might look at the bisect module (part of the standard
distribution).
--
http://mail.python.org/mailman/listinfo/python-list
John Nagle wrote:
> Were Python "eggs" a flop, or what?
No.
> We need to have one packager that everyone agrees on.
> Otherwise, installs become a mess, and then you have to have
> installers that handle multiple packagers.
Eggs and Squisher are complementary tools. Squisher is good fo
Hi John,
I don't think eggs are a flop, however the pain they are trying to
solve is generally pretty minor in the Python world vs what we often
see with other languages. We're starting to see some push to move
more 3rd party libraries and frameworks to eggs (ie: Turbogears) and
as the developer
On Mar 16, 12:59 pm, [EMAIL PROTECTED] wrote:
> I have an ordered list e.g. x = [0, 100, 200, 1000], and given any
> positive integer y, I want to determine its appropriate position in
> the list (i.e the point at which I would have to insert it in order to
> keep the list sorted. I can clearly do
On Mar 16, 12:42 pm, [EMAIL PROTECTED] wrote:
> Hello everyone!
> i have the following test code:
> class temp:
> def __init__(self):
> self.hello = "hello world!"
> def printworld(self):
> print(self.hello)
> t = temp()
>
> and i tried to call profile('t.printworld()')
>
>
Hi all, my Python (2.4) program crashed after a couple days of running
(this'll be a pain to debug, I know). I think it just...stopped
running. My log files didn't show any (unusual) exceptions (I use the
logging module to files and stdout/stderr piped to files). I have a
feeling that the python in
Does anybody know of a good way to display Encapsulated Postscript
images in a GUI? I'm currently using wx, but would be perfectly
willing to switch to another binding to keep the program from becoming
hackish.
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I can't find any documentation on the profile() function. But it
might take a function reference as an argument and not the string you
are feeding it. For instance:
profile(t.printworld)
Note the difference between:
t.printworld
t.printworld()
The latter executes the function and then re
It's not big, but it's there. Just attaching to a MySQL
database with MySQLdb, then closing the connection without
doing anything results in some collectable garbage:
gc: collectable
gc: collectable
gc: collectable
gc: collectable
gc: collectable
(Python 2.4, MySQL 5, Windows 2000)
(For te
On Mar 16, 12:59 pm, [EMAIL PROTECTED] wrote:
> I have an ordered list e.g. x = [0, 100, 200, 1000], and given any
> positive integer y, I want to determine its appropriate position in
> the list (i.e the point at which I would have to insert it in order to
> keep the list sorted. I can clearly do
Try:
db=MySQLdb.connect(host='appx',db='sc_0',user='user',passwd='secret',
use_unicode=True, charset = "utf8")
The distinction is that "use_unicode" tells Python to convert to Unicode,
but Python doesn't know the MySQL table type. 'charset="utf8"' tells
MySQL to do the conversion to
Thanks a lot for the help guys, I'm at work right now and I will go
over your suggestions one by one this weekend. Being more alert now,
taking a look at the examples you posted, I now see how to approach
this problem. The thing with python that I'm starting to realize is
that there are a million
Thanks a lot for the help guys, I'm at work right now and I will go
over your suggestions one by one this weekend. Being more alert now,
taking a look at the examples you posted, I now see how to approach
this problem. The thing with python that I'm starting to realize is
that there are a million
On Mar 16, 2:32 pm, "Paul McGuire" <[EMAIL PROTECTED]> wrote:
> On Mar 16, 12:59 pm, [EMAIL PROTECTED] wrote:
>
>
>
> > I have an ordered list e.g. x = [0, 100, 200, 1000], and given any
> > positive integer y, I want to determine its appropriate position in
> > the list (i.e the point at which I w
I'm getting the following trace in python 2.5:
Traceback (most recent call last):
File "./template_unittest.py", line 36, in
zencc.start_browser(machines.zones[0].devices.get_primary_servers()[0])
File "/home/bean/code/automation/nrm-qa/trunk/brimstone/lib/zcc.py", line
221, in start_browse
My attempt uses a different approach: create two sorted arrays, n^2
elements each; and then iterate over them looking for matching
elements (only one pass is required). I managed to get 58,2250612857 s
on my 1,7 MHz machine. It requires numpy for decent performance,
though.
import numpy
import tim
hi, i made a program in python but received global name error. the program
code;
serverhost = '127.0.0.1'
serverport = 2000
BUFSIZ = 1024
addr = (serverhost,serverport)
if str(sys.argv).find("-s") == -1:
cs = socket(AF_INET, SOCK_STREAM,0) # create a TCP socket
cs.c
How about:
---
x = [0, 100, 200, 1000]
y = -1
inserted = False
for i in range(len(x)):
if(y <= x[i]):
x.insert(i, y)
inserted = True
break
if(not inserted): x.append(y)
print x
--
http://mail.python.org/mailman/listin
Paulo da Silva escreveu:
> Alex Martelli escreveu:
>> Paulo da Silva <[EMAIL PROTECTED]> wrote:
>
>
>> E.g.:
>>
>> class C1(object):
>> def __new__(cls, xxx):
>> if xxx: return type.__new__(cls, xxx)
>> else: return C1.load(xxx)
>> @staticmethod
>> def load(xxx):
On Mar 16, 11:20 am, "Matimus" <[EMAIL PROTECTED]> wrote:
> You might look at the bisect module (part of the standard
> distribution).
Here is an example:
>>> from bisect import insort
>>> x = [0,100,200,1000]
>>> insort(x,10)
>>> x
[0, 10, 100, 200, 1000]
--
http://mail.python.org/mailman/list
Hi,all
I am new to this list. And I am glade I am here.
I have a question. I need to do some text processing. I need to read from a
file line by line. If some line is met with some condition, the previous line
needs some modification. How to get the info of the previous line?
Thanks!
Qilong
On Friday 16 March 2007 12:41, Clement wrote:
> Can a object sharable by two different python programs... If so can you
> please explain... because my project needs two programs to access nearly
> 45GB file Symentaniously...
What kind of information is that? Can you put it into a database?
Chris
Or like this:
x = [0, 100, 200, 1000]
y = 435
for n, i in enumerate(x):
if y < i:
n = n - 1
break
x.insert(n + 1, y)
If you decide to stick with
n = sum ( y>x[i] for i in range(len(x)) ) - 1
Replace it with:
lines = open('/tmp/foo.py',
"r").read().splitlines()
previous_line =
''
Hi, Shane,
Thanks for fast reply.
What I used is :
for line in open(FILE):
I don't want to store all lines in a list because sometimes the file is very
large. We need to store the value of the previous line in a variable. Is that
right?
Thanks,Qilong
- Original Message
On Mar 16, 3:51 pm, Shane Geiger <[EMAIL PROTECTED]> wrote:
> lines = open('/tmp/foo.py',
> "r").read().splitlines()
>
> previous_line =
> ''
>
> for line in
> lines:
>
> if "foo" in
> line:
>
> print "found foo in the current line. The previous line is: "
> +
> previous_line
>
>
On Mar 16, 3:51 pm, Shane Geiger <[EMAIL PROTECTED]> wrote:
> lines = open('/tmp/foo.py',
> "r").read().splitlines()
>
>
> previous_line =
> ''
On 3/16/07, Qilong Ren <[EMAIL PROTECTED]> wrote:
> I have a question. I need to do some text processing. I need to read from a
> file line by line. If some line is met with some condition, the previous
> line needs some modification. How to get the info of the previous line?
I would do something
Seems to me that one should be able to put the names of several
functions in a list and then have the list executed. But it seems the
output of the functions is hidden, only their return value is visible.
Is this because the list execution is another scope?
Thanx,
jh
~~~
Python help,
I just started working with SQLite3 and ran into
this problem.
Below, the first select produces results but,
after closing then re-opening the database the
select produces an empty list. Anyone know the
reason ??
The table seems to be empty.
import sqlite3
con = sqlite3.c
lst = [a, b]
The () symbol causes the named function to execute, and a function
call in the code is always replaced by the function's return value.
--
http://mail.python.org/mailman/listinfo/python-list
John Nagle wrote:
> Try:
>
> db=MySQLdb.connect(host='appx',db='sc_0',user='user',passwd='secret',
> use_unicode=True, charset = "utf8")
>
> The distinction is that "use_unicode" tells Python to convert to Unicode,
> but Python doesn't know the MySQL table type. 'charset="utf8"' tells
>
On Mar 16, 3:59 pm, "7stud" <[EMAIL PROTECTED]> wrote:
> lst = [a, b]
>
> The () symbol causes the named function to execute, and a function
> call in the code is always replaced by the function's return value.
Try this:
--
def a():
print "this is a"
def b():
print "this is b
On Mar 16, 5:10 pm, [EMAIL PROTECTED] wrote:
> On Mar 16, 3:51 pm, Shane Geiger <[EMAIL PROTECTED]> wrote:
>
>
>
> > lines = open('/tmp/foo.py',
> > "r").read().splitlines()
>
> > previous_line =
> > ''
>
> > for line in
> > lines:
>
> > if "foo" in
> > line:
>
> > print "found foo in t
from John Clark
use con.commit()
Thanks John,
this works
jim-on-linux
On Friday 16 March 2007 17:55, jim-on-linux wrote:
> Python help,
>
> I just started working with SQLite3 and ran
> into this problem.
>
> Below, the first select produces results but,
> after closing then re-opening the
Then after defining clientsock, write a print statement as "print
clientsock", see what it will print, None or a object?
Sönmez
ANIL KARADAĞ wrote:
> ok , arranged block.but program give error global name 'clientsock' is not
> defined " ,..
>
> 2007/3/17, Sönmez Kartal <[EMAIL PROTECTED]>:
>>
>
On 3/16/07, jim-on-linux <[EMAIL PROTECTED]> wrote:
> Below, the first select produces results but,
> after closing then re-opening the database the
> select produces an empty list. Anyone know the
> reason ??
When you first open a connection, you implicitly begin a transaction.
You need to call
1 - 100 of 125 matches
Mail list logo