Jeffrey Schwab wrote:
> Danny wrote:
>
>> Great! It's been solved.
>>
>> The line, as Glaudio said has a "," at the end and that makes it go
>> onto one line, thanks so much man!
>>
>> var = 0
>> while <= 5:
>> print a[t[var]],
>> var = var +1
>> prints perfectly, thanks so much guys.
>
>
Re-reading my message I noticed a stupid error, not effecting my
problem but annoying, I assigned variables and then did not use them,
then included import cgi for my regular script. This is how the command
line script should look:
#!/usr/bin/python
import MySQLdb
db=MySQLdb.connect(host = '192.
I have a file of lines that contains some extraneous chars, this the
basic version of code to process it:
IDtable = "".join(map(chr, xrange(256)))
text = file("...", "rb").read().translate(IDtable, toRemove)
for raw_line in file(file_name):
line = raw_line.translate(IDtable, toRemove)
...
A
Hola,
Aca con una pregunta basica:
A veces veo que hay programas que tienen varias instrucciones en la
misma linea, cuando lo que aprendi de Python era que se usaba el
espaciado para mantener la estructura (indent).
Por ejemplo:
if name != 'comic': return
Hay un return despues de los dos puntos, n
NateM wrote:
> Thank you! If I am reading in dates as strings from a text file, like
> "5/11/1998", how do I convert that to a format I can pass into mktime?
> Thanks again.
>
Check time.strptime()
--
http://mail.python.org/mailman/listinfo/python-list
Danny wrote:
> I think I should paste some of the programs code a little more of what I
> want...
probably...
> var = 0
> while var <= 5:
> print a[t[var]]
> var = var +1
>
> a is a dectionary (very big) and t is a string of text. (if that's
> important right now).
It might be important
Danny wrote:
> Great! It's been solved.
>
> The line, as Glaudio said has a "," at the end and that makes it go onto
> one line, thanks so much man!
>
> var = 0
> while <= 5:
> print a[t[var]],
> var = var +1
> prints perfectly, thanks so much guys.
Looping over indexes is kinda unpyth
Danny <[EMAIL PROTECTED]> wrote:
>The programs output will be:
>text
>text
>(etc)
>
>How could I make this print: texttexttexttexttext?
>Ive researched and looked through google and so far I can't find
>anything that will help (or revelent for that matter).
I'm kind of surprised this isn't a FAQ
Terry Hancock:
>Rene Pijlman:
>> Option 1:
>> Install ZODB in the Python installation in the usual way.
>> Should I expect problems when I install and run zope with
>> that Python installation?
>
>I think this should work, actually.
>
>ZODB is just like other databases in that each application
>is
Danny wrote:
> Great! It's been solved.
>
> The line, as Glaudio said has a "," at the end and that makes it go onto
> one line, thanks so much man!
>
> var = 0
> while <= 5:
>print a[t[var]],
>var = var +1
> prints perfectly, thanks so much guys.
if you wanted spaces between the items, w
Danny wrote:
> I think I should paste some of the programs code a little more of what I
> want...
>
> var = 0
> while var <= 5:
> print a[t[var]]
> var = var +1
>
> a is a dectionary (very big) and t is a string of text. (if that's
> important right now).
>
> I'm just trying to make the
Great! It's been solved.
The line, as Glaudio said has a "," at the end and that makes it go onto
one line, thanks so much man!
var = 0
while <= 5:
print a[t[var]],
var = var +1
prints perfectly, thanks so much guys.
--
http://mail.python.org/mailman/listinfo/python-list
Danny wrote:
> I think I should paste some of the programs code a little more of what I
> want...
>
> var = 0
> while var <= 5:
> print a[t[var]]
> var = var +1
>
> a is a dectionary (very big) and t is a string of text. (if that's
> important right now).
>
> I'm just trying to make th
I think I should paste some of the programs code a little more of what I
want...
var = 0
while var <= 5:
print a[t[var]]
var = var +1
a is a dectionary (very big) and t is a string of text. (if that's
important right now).
I'm just trying to make the value of a[t[var]] print on one l
Danny wrote:
> How could I make this print: texttexttexttexttext?
> Ive researched and looked through google and so far I can't find
> anything that will help (or revelent for that matter).
I am not quite sure, if I simplify the problem but i thought about
something like that:
>>> prin
Steven D'Aprano wrote:
> > Of course. I was just trying to make a point about string accumulation being
> > O(n) and not O(n^2).
>
> But according to Fredrik, string accumulation is still quadratic, even
> with the optimizations added to Python 2.4. Quoting:
>
> "it only means that if the interpre
Danny wrote:
>
As a shortcut:
print "text"*5
--- Heiko.
--
http://mail.python.org/mailman/listinfo/python-list
Enrique Palomo Jiménez wrote:
> Hi all,
>
> I want to take an existing pdf and add it a non-opaque watermark.
> I have tried it in postscript but postscript hava an opaque imaging model.
> Pdf allows it. I can do it with acrobat 6.0, but i need to add the watermark
> in batch mode or inside an ap
Danny wrote:
> Hello there.
>
> I'm creating a little text changer in Python. In the program there is a
> while loop. The problem is that a while loop will have 1 print statement
> and it will loop until it gets to the end of the text.
> Example:
>
> num = 5 // Set num to 5
> while num >= 1: /
On Wed, 25 Jan 2006 15:50:27 -0600, [EMAIL PROTECTED] wrote:
>
>>> If they need to resume their calculations from where they left off
>>> after the last yield.
>
>Wolfgang> Well, no, independently from that.
>
>Wolfgang> Just to avoid to inital overhead of the function call.
>
>Ho
Hello there.
I'm creating a little text changer in Python. In the program there is a
while loop. The problem is that a while loop will have 1 print statement
and it will loop until it gets to the end of the text.
Example:
num = 5 // Set num to 5
while num >= 1: // loop 5 times.
print
Fred wrote:
> I hope someone can help me with the below problem...
>
> Thanks,
> Fred
>
> My enviroment:
> --
> Slackware Linux 10.2
> Python 2.4.2
> MySql version 4.1.14
> MySql-Python 1.2.0
>
> What I am trying to do:
> ---
> Using MySQL, Python,
R. Bernstein wrote:
> Giovanni Bajo suggests:
>
>
>>If you call OptionParser.disable_interspersed_args() on your parser,
>>it will stop parsing at the first positional argument, leaving other
>>options unparsed.
>
>
> Wow - that was a quick answer! Thanks - it works great!
>
> I see how I miss
Rob Cowie wrote:
> Take a look at www.reportlab.org. The ReportLab library includes a
> graphics module that might well do what you need. I'm not sure at
> present if it allows one to set alpha-channels to achieve transparency.
>
ReportLab allows one to set a transparent image colour mask which i
Runsun Pan helped me out with the following:
You can also try the following very primitive solution that I
sometimes
use to extract simple information in a quick and dirty way:
def extract(text,s1,s2):
''' Extract strings wrapped between s1 and s2.
>>> t="""this is a
Hi all,
I want to take an existing pdf and add it a non-opaque watermark.
I have tried it in postscript but postscript hava an opaque imaging model.
Pdf allows it. I can do it with acrobat 6.0, but i need to add the watermark in
batch mode or inside an application.
I've found lowagie library for
Take a look at www.reportlab.org. The ReportLab library includes a
graphics module that might well do what you need. I'm not sure at
present if it allows one to set alpha-channels to achieve transparency.
Also, if you have access to a mac running OS X 10.4, the Automator
application has a prebuilt
Dear all,
another little question, I use idle 1.1.2, is there a way to use a
history for the command line?
thanks in advance
--
http://mail.python.org/mailman/listinfo/python-list
Giovanni Bajo suggests:
> If you call OptionParser.disable_interspersed_args() on your parser,
> it will stop parsing at the first positional argument, leaving other
> options unparsed.
Wow - that was a quick answer! Thanks - it works great!
I see how I missed this. Neither disable_.. or enable_
bruno at modulix wrote:
> Paul McGuire wrote:
>> or am I taking advantage of a fortuitous accident, which may get
>> undone at a future time?
>
> It's certainly not a fortuitous accident.
And even the (printed) cookbook has examples which assign to
self.__class__... I guess this means this featu
Fred wrote:
> I hope someone can help me with the below problem...
>
> Thanks,
> Fred
>
> My enviroment:
> --
> Slackware Linux 10.2
> Python 2.4.2
> MySql version 4.1.14
> MySql-Python 1.2.0
>
> What I am trying to do:
> ---
> Using MySQL, Python,
Paul McGuire wrote:
> I have some places in pyparsing where I've found that the most
> straightforward way to adjust an instance's behavior is to change its class.
Hooray ! You've just (re)discovered the state pattern... for which the
most stupid simple implementation in Python is to :
>(snip) as
I have some places in pyparsing where I've found that the most
straightforward way to adjust an instance's behavior is to change its class.
I do this by assigning to self.__class__, and things all work fine.
(Converting to use of __new__ is not an option - in one case, the change is
temporary, and
[EMAIL PROTECTED] wrote:
> and put them on the widgets like this:
>
> Label(win, text=message, background=rgb(150,150,120), image=photo2).pack()
> ...
>
> Now, I want the same program to run as exe file on another computer,
> so I compiled it with py2exe. I copied the bmp's to the same folder as
>
Alex Martelli wrote:
> Rene Pijlman <[EMAIL PROTECTED]> wrote:
>> Peter Otten:
>> s = set(["one-and-only"])
>> item, = s
>...
>> >The comma may easily be missed, though.
>>
>> You could write:
>>
>> (item,) = s
>>
>> But I'm not sure if this introduces additional overhead.
>
I'm battling to understand this. I am switching to python while in a
production environment so I am tossed into the deep end. Python seems
easier to learn than other languages, but some of the conventions still
trip me up. Thanks for the link - I'll have to go through all the
previous chapters to u
201 - 236 of 236 matches
Mail list logo