pyqt
Hi, I'm trying to explore pyqt: ev erthing works OK, but I have still two questions: - Can I execute bash commands in a python script (e.g. ls -l or grep)? - In the QT Designer there are also KDE-widgets but I'm not sucseeded to get them work in pyqt (it says: "self.kProgress1 = KProgress(self,"kProgress1") NameError: global name 'KProgress' is not defined"). Are the not implemented there or I should install some additional software? regards Kuljo -- http://mail.python.org/mailman/listinfo/python-list
new line
Dear friends I'm so sorry to bore you with this trivial problem. Allthou: I have string having 0x0a as new line, but I should have \n instead. How should I solve it? I've tried >>>text_new=tex_old.replace(str(0x0a), '\n') and other things, but none of them worked. Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: new line
Kuljo wrote: > Dear friends > I'm so sorry to bore you with this trivial problem. Allthou: I have string > having 0x0a as new line, but I should have \n instead. > How should I solve it? > I've tried >>>>text_new=tex_old.replace(str(0x0a), '\n') > and other things, but none of them worked. > Thanks in advance I have found this in the meantime: >>>nl="\\"+"n" >>>text_new=replace(text_old, chr(10), nl) It works. -- http://mail.python.org/mailman/listinfo/python-list
Re: new line
Kuljo wrote: > Kuljo wrote: > >> Dear friends >> I'm so sorry to bore you with this trivial problem. Allthou: I have >> string having 0x0a as new line, but I should have \n instead. >> How should I solve it? >> I've tried >>>>>text_new=tex_old.replace(str(0x0a), '\n') >> and other things, but none of them worked. >> Thanks in advance > > > I have found this in the meantime: > >>>>nl="\\"+"n" >>>>text_new=replace(text_old, chr(10), nl) > > It works. Thanks Peter, you are right, even >>>text_new=replace(text_old, chr(10), "\\n") works. Yes, it was exactly what I needed. The problem actually was: I'm using Pilot V for years and a part of my "knowledge base" is stored in den memo files. On the PC side I'm using jpilot (Linux Kubuntu 5.04) which works perfectly. Now I wanted to try out kontact (groupware). The shortcoming is that kontact (actually kpilot in the background) does not import the memos. But it store them in a folder as a file per memo. In this file are the cr/lf indicated by hex 0a. The notes in kontact uses char \n instead. For this translation I made a python script which works now. Kind regards Kuljo -- http://mail.python.org/mailman/listinfo/python-list
MySQLdb - Tuples
Hallo, ich bin voll neu im Python-Programming, deshalb ist mein Problem wahrscheinlich trivial: Wenn ich die Script #33 #! /usr/bin/env python import MySQLdb db=MySQLdb.connect(host='localhost', db='photum_0_6_2', user='root', passwd='thkhgfgd') c=db.cursor() c.execute('select person from persons order by person') tup=c.fetchall() for a in tup: print a ausführe, erhalte ich Dinge wie ('Dieter',) ('Hulda',) Ich brauche die Klammern, Apostrphe und Kommas nicht (ich will nur die Inhalte) und kann ich sie nicht loswerden. Versucht habe ich u. a. print a[2:-3] was nur zwei Klammern bringt. b=lstrip(a, "(") haut auch nicht hin. Weiss jemand Rat? P.S. Woher kommen diese Klammern und Apostrophen, vom MySQLdb? -- http://mail.python.org/mailman/listinfo/python-list
Re: MySQLdb - Tuples
Dennis Benzinger wrote: Lajos Kuljo wrote: Hallo, ich bin voll neu im Python-Programming, deshalb ist mein Problem wahrscheinlich trivial: Wenn ich die Script #33 #! /usr/bin/env python import MySQLdb db=MySQLdb.connect(host='localhost', db='photum_0_6_2', user='root', passwd='thkhgfgd') c=db.cursor() c.execute('select person from persons order by person') tup=c.fetchall() for a in tup: print a ausführe, erhalte ich Dinge wie ('Dieter',) ('Hulda',) Ich brauche die Klammern, Apostrphe und Kommas nicht (ich will nur die Inhalte) und kann ich sie nicht loswerden. Versucht habe ich u. a. print a[2:-3] was nur zwei Klammern bringt. b=lstrip(a, "(") haut auch nicht hin. Weiss jemand Rat? Hab gerade kein MySQL da, aber änder mal for a in tup: print a in for a in tup: print a[0] # Das erste Element des Tupels Dann wird statt des ganzen Tupels nur das erste Element ausgegeben. P.S. Woher kommen diese Klammern und Apostrophen, vom MySQLdb? Die Klammern und Apostrophe kommen daher, dass tup ein Tupel (http://docs.python.org/lib/typesseq.html) mit einem Element (der Person) ist. Dennis Thank you Dennis, it works! Sorry for the wrong language. I'm getting older. Kind regards Lajos -- http://mail.python.org/mailman/listinfo/python-list