selecting files from MySQL
Andy Todd
andy47 at halfcooked.com
Mon Apr 1 23:03:12 EST 2002
"amy" <amylang at zedat.fu-berlin.de> wrote in news:a87o30$qabnh$1 at fu-
berlin.de:
> hello python-knowing,
> can somebody help me to solve a little problem in a script, sc selecting
> files from a mysql database?
> so far, it doesn't want to work:
>
>
> if fileid['translation'] == 'none':
> actie = suchen fileid == 'none'
> elif fileid['translation'] == 'de-orig':
> actie = suchen fileid == 'de-orig'
> elif fileid['translation'] == 'nl-orig':
> actie = suchen fileid == 'nl-orig'
> elif fileid['translation'] == 'no-orig':
> actie = suchen fileid == 'no-orig'
> else:
> search = opt['such']
>
>
> thanks a lot, if it's possible
> amy
>
>
Amy,
This isn't C, you can either do a comparison OR an assigment on each line,
not both.
Thus, all of your lines like;
actie = suchen fileid == 'no-orig'
are invalid syntax. Are you trying to assign a value to 'actie' and to
'fileid', or are you trying to assign a value to 'actie' if 'fileid' has
another specific value in it? In Python '=' is assignment (well, reference
but lets not go there just yet) and '==' is a comparison operator.
Perhaps it would be best if you said what you want to do and then ask for
examples of how to do it.
Also, this code fragment doesn't appear to have anything to do with MySQL
but your subject says you are trying to select files from MySQL? Is that
important here or do you just need to get this particular section of your
code working first?
Finally, a good tip for posts to the newsgroup is to try out your code in
the Python interpreter (or idle, or Pythonwin) and include in your post any
and all error messages or exceptions you get when you try to run it.
HTH,
Andy
--
Contents free posts a speciality
More information about the Python-list
mailing list