Am 18.07.2008 14:33, antar2 schrieb:
I want to replace each first element in list 5 that is equal to the
first element of the list of lists4 by the fourth element. I wrote
following code that does not work:
list4 = [['1', 'a', 'b', 'c'], ['2', 'd', 't', 'e'], ['8', 'g', 'q',
'f']]
list5 = ['1',
On 09.11.2006 10:52, Lad wrote:
> I have a sorted list for example [1,2,3,4,5] and I would like to change
> it in a random way
> e.g [2,5,3,1,4] or [3,4,1,5,2] or in any other way except being
> ordered.
> What is the best/easiest
> way how to do it?
>
> Thank you for help
> L.
>
use random.shu
On 06.07.2006 12:43, manstey wrote:
> Hi,
>
> I often have code like this:
>
> data='asdfbasdf'
> find = (('a','f')('s','g'),('x','y'))
> for i in find:
>if i[0] in data:
>data = data.replace(i[0],i[1])
>
> is there a faster way of implementing this? Also, does the if clause
> increa
On 28.06.2006 10:01, Girish Sahani wrote:
> Sorry for spamming again, but please also enlighten me with some way to
> time a function i.e. to find out how much time each function takes for
> execution in a big program.
>> Hi all,
>>
>> Can anyone tell me the simplest way to do it (some code snipp
rodmc wrote:
> I need to write a Python application which connects to a MySQL 5.0
> database. Can anyone point me in the right direction or a compatible
> library?
>
> Best,
>
> rod
>
See http://sourceforge.net/projects/mysql-python
HTH,
Wolfram
--
http://mail.python.org/mailman/listinfo/pyt
sandorf wrote:
> I'm new to python. Have a simple question.
>
> "open" function can only open an existing file and raise a IOerror when
> the given file does not exist. How can I creat a new file then?
>
open the new file in write mode: open('foo', 'w')
See: help(open)
HTH,
Wolfram
--
http://ma
Nico Grubert wrote:
> Hi there,
>
> on a Linux machine running Python 2.3.5. I want to create a file
> 'newfile' in a directory '/tmp' only if there is no file 'transfer.lock'
> in '/temp'.
> A cronjob creates a file 'transfer.lock' in '/temp' directory every 15
> minutes while the cronjob is d
rock69 wrote:
> Hi all :)
>
> I got this address:
>
> http://www.infomedia.it/immagini/riviste/covers/cp/cp137.jpg
>
> and I would like to download that image and save it to a local file.
> How do you do that in Python?
>
Use urllib2:
http://docs.python.org/lib/module-urllib2.html
http://docs.
Ric Da Force wrote:
> Hi,
>
> I have a string such as 'C1, C2, C3'. Without assuming that each bit of
> text is of fixed size, what is the easiest way to change this list so that
> it reads:
> 'C1, C2 and C3' regardless of the length of the string.
>
> Regards and sorry for the newbie questio
nephish wrote:
[...]
>> Try the following from the shell (NOT the python shell):
>> mysql -u user -p
>> [Enter passwd]
>> mysql> show databases;
>>
>> If MyDB isn't in the list either something went wrong with the xampp
>> installation or the database for xampp got a different name. (I am no
>>
[EMAIL PROTECTED] wrote:
> Hey there all,
> i have a question about how to point my python install to my sql
> database.
>
> when i enter this: db = MySQLdb.connect(user="user", passwd="pass",
> db="myDB")
>
> i get this:
> Traceback (most recent call last):
> File "", line 1, in -toplevel-
>
mg wrote:
> Hello,
>
> I am writting bindings for a FEM application. In one of my function
> 'initModulename', called when the module is imported, I would like to
> get the argc and argv arguments used in the main function of Python.
> So, my question is: does the Python API containe fonctions
Kay Schluehr wrote:
>
> Wolfram Kraus wrote:
>
>> Kay Schluehr wrote:
>>
>>> The last downloadable release is from november 2004. The Windows
>>> installer is configured for Python 2.3(!). The Zope.org main page
>>> announces Zope 2.8 beta 2. Is
Kay Schluehr wrote:
> The last downloadable release is from november 2004. The Windows
> installer is configured for Python 2.3(!). The Zope.org main page
> announces Zope 2.8 beta 2. Is it stillborn?
>
> Kay
>
What you see is not Zope 3, it is Zope X 3. To quote from the X3
information page: "
Duncan Booth wrote:
> Michael wrote:
>
>
>>Hi,
>>I've got a string s, and i want to shift all the letters up by one, eg
>>a->b, b->c z->a
>>In c++ i can do this quite simply with
>>
>>if(C == 'z') C='a';
>>else C++;
>>
>>but i can't work out how to do this this in python??
>
>
impo
Malcolm Wooden wrote:
> my actual code is:
>
> for x in range(len(l)):
> h = string.split(l[x])
>
> where the sentence string is in an array of one element 'l'
> Error is:
>
> Traceback (most recent call last):
> File "", line 34, in ?
> File "", line 27, in SentenceText
> File "C:\P
Heiko Wundram wrote:
> Am Freitag, 27. Mai 2005 13:31 schrieb Michael:
>
>>if(C == 'z') C='a';
>>else C++;
>
>
> if C == "z":
> C = "a"
> else:
> C = chr(ord(C)+1)
>
According to the OP's problem (with the assumption that only characters
from a-z are given) he might even try a lil LC:
>
Malcolm Wooden wrote:
> I'm trying to get my head around Python but seem to be failing miserably. I
> use RealBasic on a Mac and find it an absolute dream! But PythonUGH!
>
> I want to put a sentence of words into an array, eg "This is a sentence of
> words"
>
> In RB it would be simple:
>
Wolfram Kriesing wrote:
> i was already searching and remember i had seen something like "its not
> needed".
>
> Anyway, are there any doc tags, like in Java/PHPDoc etc, where you can
> describe parameters (@param[eter]), return values (@ret[urn]),
> attributes (@var), references (@see), etc?
>
Sara Khalatbari wrote:
> You remember me asking about running a program in my
> code...I got a problem here
>
[...]
> & my code is:
> #! /usr/bin/env python
^
Remove this space, the line should be:
#!/usr/bin/env python
>
> import os
> from os import execl
>
> os.execl ('/home/sara/PYTHO
Mike wrote:
I would like my 'print' statements to send its output to the user's
screen and a log file.
This is my initial attempt:
class StdoutLog(file):
def __init__(self, stdout, name='/tmp/stdout.log',
mode='w',bufsize=-1):
super(StdoutLog, self).__init__(name,mode,bufsize)
s
Jonas Meurer wrote:
hello,
my script selects a comment saved as VARCHAR in MySQL and displays it
inside an html page.
the problem is, that the comment contains several special characters, as
mysterious utf-8 hyphens, german umlauts, etc.
i could write a function to parse the comment and substitute
[EMAIL PROTECTED] wrote:
O/S: Windows XP Home (with Service Pack 2)
Downloaded python-2.4.msi from python.org (10,632KB). When I double
click on the file from Windows Explorer, the installation process
presents the window in which I am prompted to either install for all
users (the default) or inst
Felix Hebeler wrote:
Hi all, I am doing some Python scripting for a while, but I'm not too
deep into it yet. So I have a problem I can't solve.
I need to call an object attribute:
value = object.attrName[0]
the problem is, that the attribute name can only be specified at
runtime.
So what I have is
Heyho!
I want to associate objects with the nodes of a Tix.Tree. Is this
possible, because the following example won't work:
--8<-- Cut here -
import Tix
class C:
pass
root = Tix.Tk()
top = Tix.Frame(root, relief=Tix.RAISED, bd=1)
tixtree = Tix.Tree(top)
tixtree.pack(e
Heyho!
Torsten Mohr wrote:
Hi,
along with my distribution SuSE 9.1 came python 2.3.3.
I'd like to update to 2.4 now, is this an easy thing to do or will
lots of installed modules refuse to work then?
I installed Python 2.4 under SuSE 9.1 and had no problems so far. If you
install it via "./configur
26 matches
Mail list logo