Victor Subervi wrote:
> Hi;
> I have this line of code:
> sql = 'select Name, Price from %sPackages where ID=%s;' % (store, pid)
> which prints to this:
> select Name, Price from productsPackages where ID=1;
> which when I enter it into the MySQL interpreter gives me this:
> mysql> select Name, P
Victor Subervi wrote:
> First I get scolded for not including enough information. Now I get
> scolded for including too much. Seems I can't win. I *am* putting effort
> into understanding this. I'm sorry I'm not as sharp as you are in these
> matters.
I didn't scold you for including too much info
Victor Subervi wrote:
> Code snippet:
> [...]
>
> Error:
> [...]
> What do?
After eliminating the pieces of your post that have been copied or
quoted from elsewhere, I am left with a total of five words of your own
to ask this question, which seems to be approximately the same amount of
effort yo
Victor Subervi wrote:
> I have an automatically generated HTML form from which I need to extract
> data to the script which this form calls (to which the information is
> sent).
Ideally, the script that receives the submitted fields should know how
the form was generated, so it knows what fields t
Victor Subervi wrote:
> Hi;
> I have a script that is called via the web. This script writes another
> script that is also called by the web, which in turn needs to have
> execution privileges. The problem is that the programmatically created
> file is owned by apache.apache and thus doesn't have e
thing think
> of a way to write that in fewer lines?
Couldn't you just use the built-in enumerate() to replace the whole thing?
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
t;real error"? Show us the code you
ran, the output you expected, and the output it produced instead.
Blind guess: You're using "except ProgrammingError" when you should be
using "except MySQLdb.ProgrammingError". If this guess is incorrect, see
above.
--
Carsten Haese
o the client as part of the HTTP response." [Emphasis
mine.] You even copy-and-pasted a snippet containing that very sentence
into an earlier post on this thread, so how you can now claim that the
tutorial didn't mention this is quite beyond me.
--
Carsten Haese
http://informixdb.sourcefor
ry as far as I know, whereas you appear to be trying
to earn a living writing programs. If you can't learn to think like a
programmer, sooner or later you'll have to face the grim reality that
you'll never earn a living as a programmer. Maybe you should try to earn
a living as a poet in
many times I refresh. Please advise.
That tells me nothing, because once again you're not posting your
complete code.
Anyway, the likely answer is that you guessed incorrectly. As I said
before, you need to make sure that the cookie is printed as part of the
page headers. I'll give you one last hint: The page header is where
you're printing the "Content-type" line.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
included. The
line that I had determined to be missing is in fact not missing, you
just didn't bother to post your actual code.
Now that you've posted your actual code, I can see that the actual
problem is that the line is in the wrong place.
The line in question is <>, and it's responsible for
printing a "Set-Cookie" *HEADER*, which is a fact that at least one of
the tutorials you pointed out has mentioned. You're printing it where it
doesn't belong, in the middle of your HTML output. You need to
reorganize your print statements such that the Set-Cookie header is
printed in the header of your script's output.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> On Tue, Dec 29, 2009 at 3:43 PM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
> You apparently haven't followed the tutorials carefully enough. You do
> know that a cookie is a piece of information that's stored in your
>
d the cookies on this computer. The fact that
> I'm using gmail is proof that cookies are enabled. I have also tried:
> cookie = os.environ.has_key('HTTP_COOKIE')
> Please advise.
You apparently haven't followed the tutorials carefully enough. You do
know that a cookie is a piece of information that's stored in your
browser, don't you? So tell me, which of the above lines of code do you
suppose is responsible for informing your browser of the cookie's contents?
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> On Tue, Dec 29, 2009 at 3:58 PM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
>
> Victor Subervi wrote:
> > You know I did this before, substituting "f" for "field", and it
> honestly wouldn'
to learn to understand why your code does what it does. The
desire to find out how something works is, in my opinion, an essential
skill in a programmer, and your "maybe I'll figure it out later"
attitude displays a disturbing lack of this skill.
--
Carsten Haese
http://informixdb.sour
Victor Subervi wrote:
> On Tue, Dec 29, 2009 at 12:54 PM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
>
> Victor Subervi wrote:
> > Since it is difficult to send the inputs but easy to provide the
> > outputs, and as opposed to posting t
URL. Now what? I see an HTML table, but I
can't tell how it differs from what you're expecting, because you didn't
describe what you're expecting.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
f
poorly named variables, import statements you think you need but don't,
and lots of Python anti-idioms, all of which conspire to make it
impossible for anybody who is not paid to do this work to put in the
effort that's necessary to trace your logic and identify
l code below in case it's
> necessary.
You have been told many, many times before, by myself and others, not to
embed values directly into the query string. Use parameter binding to
transmit the values to the database. I'm sure you'll find an old post of
mine somewhere in the archives of this list in which I showed you how to
do that.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
beg for more information, make random guesses, or point you at a
code example that shows how file uploads are done with the cgi module.
I'll do the latter:
http://webpython.codepoint.net/cgi_file_upload
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> On Fri, Dec 25, 2009 at 11:35 AM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
>
> Victor Subervi wrote:
> > Well I've done that. What happens is the storeColNames registers the
> > "Availability"
s obtained. Please...how do I do that??
Please be less vague. What part do you have a problem with? Checking
whether "no value is fetched" or "log the fact"?
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
ore to post your actual code. One has to wonder what causes
your persistent inability or unwillingness to honor this request.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
ist:
>>> list(aSet)
['Small', 'Extra-small', 'Medium']
Test membership in the set:
>>> 'Small' in aSet
True
>>> 'Banana' in aSet
False
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> On Sat, Dec 12, 2009 at 6:35 PM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
>
> The traceback helpfully shows us that colValue is a 1-tuple whose zeroth
> entry, colValue[0], is an actual bona-fide Python Set object. Such
>
;Extra-small', 'Medium']),)
>
> TypeError: unindexable object
> args = ('unindexable object',)
The traceback helpfully shows us that colValue is a 1-tuple whose zeroth
entry, colValue[0], is an actual bona-fide Python Set object. Such
objects aren&
resent the contents of a SET-type column.
However, I can't tell you what it actually is, because you're once again
not providing enough information. We'd need to see where colValue is
coming from to find out what colValue[0] is.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
'cheese,sauce,peperoni')
... """)
1L
>>> cur.execute("select * from pizza")
1L
>>> rows = cur.fetchall()
>>> toppings = rows[0][1]
>>> print toppings
cheese,sauce,peperoni
>>> print type(toppings)
Looks like a string to me.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
>
>
> On Sat, Dec 12, 2009 at 10:54 AM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
>
> Victor Subervi wrote:
> > Hi;
> > I'm using MySQLdb. If I do a
> > cursor.execute('describe myTable
ber of columns in the table). You must
use some other command to retrieve the result set. What command are you
using, and what are the results?
> How do I
> retrieve them?
In my version of MySQL, he default value is in the fifth column of the
result set.
--
Carsten Haese
http://inform
he
MySQL data type here. There's nothing wrong with Python's Set type.)
The above-mentioned article has a section called "Why you shouldn't use
SET." You should read it.
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
letter t, followed by an
openening parenthesis, and so on.
> Also, how can I test
> for it? It's an instance of string. How do I know if it's a set?
That's a fantastic question. Python thinks it's a string. What makes you
think it's a set?
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
ntegrity of your database query is not in danger.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
stead of
interpolating "%s" into %s markers.
Putting all that together, I'd rewrite your code above as follows:
for (column_name, pic) in zip(colNamesPics, pics):
query = ("update %s set %s = %%s where SKU=%%s" %
(store, column_name) )
parameters = (MySQLd
nstruction at a time and imagine what each instruction does. If you do
this correctly, you will understand what the code does. This won't tell
you *why* it does it, but it's your code, and you put it there to serve
a particular purpose. If you don't understand its purpose, you shou
e nothing to do with solving your actual problem.
> The dicts come from here:
>
> cursor.execute('select category from categories%s order by Category;' %
> (store[0].upper() + store[1:]))
> theTree = expand(cursor.fetchall())
>
> which is the magical code supplied
Victor Subervi wrote:
> Of course I knew about those indentation errors
That may be so, but you cleverly disguised this fact by saying the exact
opposite.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
t;, line 1, in
ValueError: too many values to unpack
As far as what's causing this error, I already explained that two weeks
ago: http://groups.google.com/group/comp.lang.python/msg/b9e02a9a9b550ad3
The fact that you're still struggling with this error is deeply
disturbing to me.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
the script, so any subsequent call
reads an empty file and results in an empty FieldStorage object. Rewrite
your code to construct the FieldStorage object once and refer to that
one object in every pass of the loop.
As you can see, and as I suspected, it's not a bug in the cgi module.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
and see if you're right that the above output
> helps you arrive at the correct conclusion.
No, it doesn't, because you've only provided one third of what I asked
for. I also asked for the code and the inputs that go into it.
--
Carsten Haese
http://informixdb.sourceforge.net
--
because you don't understand how your code works.
In order to help you diagnose the problem, we need to see the *exact*
code you're running, we need to see the *exact* inputs going into it,
and we need to see the *exact* output coming out of it.
--
Carsten Haese
http://informixdb.sour
terpolation, you don't need to do that, either.
>>> '%*d' % (8,456)
' 456'
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
functions from the options module piecemeal
into the local namespace, I just import the entire options module as its
own separate namespace.
2) I use getattr on that separate namespace to look up the desired
function object from the options module. I assign the local name
<> to the resulting f
Victor Subervi wrote:
> On Fri, Nov 27, 2009 at 12:13 PM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
>
> Victor Subervi wrote:
> > The difficulty I am having is that for
> > some reason it's not inserting. The form inserts the first ima
multiples precisely, but it can't.
> I am missing something fundamental?
>
Yes. Read http://docs.python.org/tutorial/floatingpoint.html .
Then, change "print t" to "print repr(t)" to see what's going on.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
7;t have to guess.)
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
want to
grow as a programmer.
How much time did you spend trying to figure out what that error message
is telling you? What thought processes, if any, have you followed?
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
your Unicode-related problems will disappear in a puff of
magic.) The second argument is a tuple containing the actual parameters
to be filled into the query by the database engine. This query needs
only one parameter, so I'm making a 1-tuple containing the picture
contents, wrapped insid
s. Please show us the exact
code you're using to process this file, and show us the exact contents
of the file you're processing.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
t produce
any output, and Apache is complaining about that.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> On Mon, Nov 23, 2009 at 10:08 AM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
>
> As I said, the best way we can help you is if you copy the actual error
> message so that we may diagnose the actual problem and suggest a
>
Victor Subervi wrote:
> On Mon, Nov 23, 2009 at 9:17 AM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
>
> You thought you did, but did you? The code snippet above doesn't show
> any code that closes a database connection.
>
>
> Would you be
Anjanesh Lekshminarayanan wrote:
> As of now, there is no mysql adaptor for Python3. Hence cant use
> escape_string()
Maybe it would help if you explained what you are actually trying to
accomplish.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/li
t above doesn't show
any code that closes a database connection.
> So, I replaced the last 3 lines with this:
>
> cursor.execute('use %s;' % db)
>
> but it didn't like that, either.
Do not paraphrase error messages. Copy and paste the actual error
message and
what's causing this error. Read my first response on
this thread.
(http://mail.python.org/pipermail/python-list/2009-November/1227008.html)
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
d from Dennis
Lee Bieber, apparently. Look at the function definition. It'll tell you
what the function does.
> Could
> someone please explain what this code does?
Maybe you should ask the person that wrote the code.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> On Fri, Nov 20, 2009 at 11:14 AM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
> Please show us a copy-and-paste of your command line window contents
> that result from executing <> and then executing
> <> immediately
However, the line <> indicates that the
keys in levelDict are only "nm"s, which are presumably single objects,
not pairs. Also, the "dt" that you're trying to unpack from levelDict's
keys is not used anywhere in your function.
So, this would indicate that changing the offending line to <> should fix this particular error.
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
what you did, so this experiment doesn't prove anything.
Please show us a copy-and-paste of your command line window contents
that result from executing <> and then executing
<> immediately thereafter.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
hon2.4/smtplib.py", line 49, in ?
> from email.base64MIME import encode as encode_base64
> ImportError: No module named base64MIME
>
> What gives??
Do you have a file called "email.py" in your current directory or
anywhere else on Python's pa
ting a good one isn't easy), run it
> repeatedly in a loop, and check if the returned number is 7919. Once it
> compares equal, you can print the result and you're done.
Just do a brute-force search:
for i in range(1):
if i==7919:
# Found it!
print i
;-)
--
l down to
"Implementing a COM Server.")
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> I will do that after I fix the problem
"Doing that" is the fix.
> No, this doesn't fix the problem!
How do you know? You obviously haven't tried it, since you say you have
yet to do it.
--
Carsten Haese
http://informixdb.sourceforge.net
e, the getpic scripts for the first user will be overwritten by
the getpic scripts for the second user before the first user's browser
had a chance to issue its requests for the results for his getpic scripts.
Rather than auto-generating on-the-fly variants of the getpic scr
Nadav Chernin wrote:
> Thanks, but my question is how to write the regex.
See http://www.amk.ca/python/howto/regex/ .
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> That's what I initially had. My server, that I am in
> the process of leaving, rejected that syntax.
What version of Python does that server use? The calendar.Calendar class
first appeared in Python 2.5. I suspect your server is using an older
version.
--
Ca
ng variables and so on.
At the point you marked "HERE", you've already found the method, and you
have determined that it is callable. You just need to call it. Like
this: method().
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro wrote:
> In message , Carsten
> Haese wrote:
>
>> With all due respect, but if your experience is exclusive to
>> MySQL/MySQLdb, your experience means very little for database
>> programming practices in general.
>
> I wonder abou
y
secure, whereas string interpolation is too easy to use insecurely.
Finally, parameter binding is the standard method, as defined by the SQL
standard, of getting variable values into a query.
You may call it "premature optimization", but I call it "choosing the
right tool for the
gt; Probably why I don't use Informix. What use is a binary data type if you
> can't insert and retrieve binary data values?
You CAN insert and retrieve binary data values. You just have to use the
right tool for the job, and that is parameter binding.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
y of conveying values to the database, you'd
never be able to populate a BYTE column on an Informix database. The
only way to pass a BYTE value to an Informix database is by parameter
binding.
Since parameter binding is in general much more than string
substitution, it is indeed necessary t
Lawrence D'Oliveiro wrote:
> In message , Carsten
> Haese wrote:
>
>> Lawrence D'Oliveiro wrote:
>>
>>> In message , Dennis
>>> Lee Bieber wrote:
>>>
>>>> This way regular string interpolation operations (or whatever Python
y different jobs. As long as you
understand what you're doing, there should be no confusion. (And if you
don't understand what you're doing, you shouldn't be doing it!)
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> Can you give me an example of this?
That depends. How much of your client's money are you offering us for
doing your work?
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> It doesn't work. What I want is to capture winX and winY and use them in
> python. How?
Since you're still not heeding the advice from this article, please
allow me to refer you to it again:
http://catb.org/~esr/faqs/smart-questions.html
--
Ca
tical, and they *will*
*always* produce the same results in the same context. If they don't,
then your server isn't executing the code that you think it's executing.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> in line...
>
> On Sat, Oct 17, 2009 at 11:33 AM, Carsten Haese <mailto:carsten.ha...@gmail.com>> wrote:
> Why would turning a comment into a statement NOT make a difference?!?
>
>
> You misunderstood. Leaving in the __comm
Lovely. My "plug-and-play" program has devoured two weeks of my
> time and I'm still up the creek without a paddle. Sure would appreciate
> any help you can give.
Again, you have to help us help you. I have listed the three things you
need to post together, and you haven't done that. You're giving us bits
and pieces, but nothing that's sufficiently cohesive to do any
meaningful troubleshooting on.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
def __init__(self, arg):
self.todo = "print"+arg
def printa(self):
print 'a'
def printb(self):
print 'b'
def doit(self):
func = getattr(self, self.todo)
func()
o = dummy(sys.argv[1])
o.doit()
HTH,
--
Carsten Haese
http://informixdb.sourcef
you in figuring out
what's going in is if you post the *exact* code you're running (and by
that I mean the actual code that you know your server is executing, and
not just some code that somewhat resembles the code that the server
might be executing), a detailed description of the resu
hat makes them more likely to get helpful answers.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> [snip...]
>
> print 'Content-type: image/jpeg'
> print 'Content-Encoding: base64'
> print
> print pic().encode('base64')
> print ''
>
> [snip...]
Why are you printing "" at the end of a p
s library.
Maybe, but it's impossible to tell what exactly the problem is if you
don't show us your code. hanoi.pl is part of your code, but you haven't
posted it. Please post it.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
Victor Subervi wrote:
> [...]
> print '''Content-Type: image/jpeg
>
> Content-Encoding: base64
> '''
> [...]
You have a spurious blank line between those header lines.
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
ion_key_1.encString(str(x)) for x in User ]
cur.execute(SQL, params)
That way, the parameters are passed separately and safely, and the query
syntax is protected from all the dangerous characters that are floating
around in the parameters.
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
t; points = []
py> points.append(Point(1, 2))
py> points.append(Point(2, 3))
py>
py> point = points[0]
py> print point.x, point.y
1 2
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
p2key" if you want to see the code that does
this transformation.
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
forth between server and client. You should look
into the concept called "session variables".
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
r wrote:
> Of course in python you would do...
> vector.reverse --> in-place
> vector.reversed --> in-place
You do know that only one of those works in-place, right?
> The above example works pretty good, but this doesn't always "sound"
> good. Take for example this...
> point3d.offset -->
PYTHONPATH. Then you can
simply "import diomodule" and refer to the module by the name "diomodule".
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
diomodule = project.drivers.dio.diomodule
Hope this helps,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
d,
but different parameters are bound to it (many times).
"""
You might want to check on a list dedicated to adodbapi whether there
are module-specific quirks or caveats to watch out for. Or wait for
somebody with adodbapi-specific knowledge to chime in.
HTH,
--
Carst
Marco Mariani wrote:
> dateutil can do this and much, much more.
Using dateutil for this is like using a sledgehammer to kill a fly. The
task at hand can (and IMHO should) be solved with the standard datetime
module.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.
previous month
from there.
Hope this helps,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
encode('ascii','ignore')
>
> ...but the 'FFFD' still comes through.
You must be doing something wrong, then:
py> u'Hello,\ufffd World'.encode('ascii', 'ignore')
'Hello, World'
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
keys are neither added nor deleted, the order
> of iteration will not change"?
Neither of those convey the above guarantee.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
ml#mapping-types-dict :
"""
If items(), keys(), values(), iteritems(), iterkeys(), and itervalues()
are called with no intervening modifications to the dictionary, the
lists will directly correspond.
"""
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
ious (though memory-inefficient) replacement is to accumulate a
list and return the list. Initialize a result variable to an empty list,
and instead of yielding elements, append them to the result variable.
Then return the result variable at the end of the function.
HTH,
--
Carste
Astley Le Jasper wrote:
> Sorry for the numpty question ...
>
> How do you find the reference name of an object?
>
> So if i have this
>
> bob = modulename.objectname()
>
> how do i find that the name is 'bob'
Why do you need to find that? You know that
Roy Smith wrote:
> Does there exist a pure Python version of a MySQL module?
A quick google search turns up this:
http://github.com/mopemope/pure-python-mysql/tree/master/pymysql
I've never used it, though, so I have no idea whether it works or how
well it works.
HTH,
--
Carsten Ha
1 - 100 of 685 matches
Mail list logo