On Thu, Oct 21, 2010 at 15:44, Richard D. Moores wrote:
>> If you want to control the number of decimal places in the string
>> formatting do something like:
>>
> i = 3
> print ("NEW LOW: %%.%sf at %%s" % i) % (lowz, timestamp)
>> NEW LOW: 81.750 at 22:55:13
> i = 6
> print ("NEW L
On Fri, Oct 22, 2010 at 9:42 AM, Richard D. Moores wrote:
> On Thu, Oct 21, 2010 at 15:44, Richard D. Moores wrote:
>>> If you want to control the number of decimal places in the string
>>> formatting do something like:
>>>
>> i = 3
>> print ("NEW LOW: %%.%sf at %%s" % i) % (lowz, timesta
On Fri, Oct 22, 2010 at 06:47, David Hutto wrote:
>> which works fine, but a question remains: n is an integer. Why the 's'
>> in '%sf'?
>
> Right here:
> http://docs.python.org/release/2.5.2/lib/typesseq-strings.html
Sorry, but I don't see the answer to my question there.
Dick
_
Ara Kooser wrote:
> Thank you for your response. I did try reading the documentation but I
> missed something (or several somethings in this case). So what I see in
> the code you supplied is:
>
> with open(source, "rb") as instream:
>reader = csv.DictReader(instream, skipinitialspace=True)
On Fri, Oct 22, 2010 at 9:55 AM, Richard D. Moores wrote:
> On Fri, Oct 22, 2010 at 06:47, David Hutto wrote:
>>> which works fine, but a question remains: n is an integer. Why the 's'
>>> in '%sf'?
>>
>> Right here:
>> http://docs.python.org/release/2.5.2/lib/typesseq-strings.html
>
> Sorry, but
If I understand what i just said correctly, it just means it tells the
string what type to convert from when placing it into the final
result.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/ma
I am trying to create a function to plug into a restart script I'm creating. I
can't seem to successfully loop through making an http connection, if it fails
to retry, if it succeeds, to end and continue with its parent function.
I'm using the Fabric project's module and including my functions
On 10/22/2010 10:54 AM, Jeff Honey wrote:
I am trying to create a function to plug into a restart script I'm creating. I
can't seem to successfully loop through making an http connection, if it fails
to retry, if it succeeds, to end and continue with its parent function.
I'm using the Fabric
> def is_ready():
>
> with settings(
>
> warn_only=True
>
> ):
>
> try:
>
> urllib2.urlopen('http://'+env.host_string+'\:8080')
>
> except urllib2.URLError:
>
> time.sleep(10)
>
> urllib2.urlopen('http://'+env.host_string+'\:8080')
>
> I am trying to get the 'host_string' environment var
"Richard D. Moores" wrote
return ("%%.%sf" % n) % floatt
which works fine, but a question remains: n is an integer. Why the
's'
in '%sf'?
Its arbitrary. You could use %d just as easily.
%s will put the numner into the string, so will %d.
%d is probably a bit more picky about what it in
My script doesn't want to recognize the variables from the exec() command in
PHP. Plus, it won't capture the results of the script.
This Python script works in IDLE, and I've got some testing code in there.
One Known Unsolved Issue:
I put Python in C:\Program Files\Python26\python.exe and have tr
On 10/22/2010 2:52 PM, Roy Hinkelman wrote:
My script doesn't want to recognize the variables from the exec()
command in PHP. Plus, it won't capture the results of the script.
This is a pretty vague description of the problem. Please provide
explicit details.
This Python script works in
On Fri, Oct 22, 2010 at 11:27, Alan Gauld wrote:
>
> "Richard D. Moores" wrote
>
>> return ("%%.%sf" % n) % floatt
>>
>> which works fine, but a question remains: n is an integer. Why the 's'
>> in '%sf'?
>
> Its arbitrary. You could use %d just as easily.
> %s will put the numner into the stri
My script doesn't want to recognize the variables from the exec() command in
PHP. Plus, it won't capture the results of the script.
This Python script works in IDLE, and I've got some testing code in there.
One Known Unsolved Issue:
I put Python in C:\Program Files\Python26\python.exe and have tr
Am new to Python, and having difficulty with Error Messages
I 'm using Python 3.1
And PyScripter as my editor
I want to process a comma delimited file one line at a time and
Interact with the fields within each line.
I found this script when looking at the CVS module and loaded
It into PyS
On Sat, 23 Oct 2010 12:42:50 am Richard D. Moores wrote:
> So I wrote a function:
>
> def float2n_decimals(floatt, n):
> """
> Given a float (floatt), return floatt to n decimal places.
>
> E.g., with n = 2, 81.34567 -> 81.35
> """
> return ("%%.%sf" % n) % floatt
>
> which wor
On Fri, Oct 22, 2010 at 8:49 PM, Terry Green wrote:
> Am new to Python, and having difficulty with Error Messages
>
> I ‘m using Python 3.1
>
> And PyScripter as my editor
>
>
>
> I want to process a comma delimited file one line at a time and
> Interact with the fields within each line.
> I found
On Sat, 23 Oct 2010 01:54:47 am Jeff Honey wrote:
> def is_ready():
> with settings(
> warn_only=True
> ):
> try:
>urllib2.urlopen('http://'+env.host_string+'\:8080')
> except urllib2.URLError:
>time.sleep(10)
>urllib2.urlopen('http://'+env.host_string+'\:8080')
That will only
On Sat, 23 Oct 2010 05:52:06 am Roy Hinkelman wrote:
> My script doesn't want to recognize the variables from the exec()
> command in PHP. Plus, it won't capture the results of the script.
"My script"? What are you talking about? You have at least two -- a PHP
script and a Python script. If you'r
On Sat, 23 Oct 2010 05:49:07 am Terry Green wrote:
> I found this script when looking at the CVS module and loaded
> It into PyScripter, but get: Syntax Error: Invalid Syntax
> Cannot figure out why and Googleing for help doesn't help
>
> Any ideas?
No, no, don't show us the actual error that you
What my buddy pal is saying, is that you should start at the
beginning. I first downloaded x version of python to x operating
system, then I tried this tutorial with these explicit
modules/requirements(which I may or not have) then progress to the
smaller aspects, like this won't iterate, or that d
It's great to have you chime in, Steven. I do wish you would stop
pulling your punches, however. ;)
On Fri, Oct 22, 2010 at 17:23, Steven D'Aprano wrote:
> On Sat, 23 Oct 2010 12:42:50 am Richard D. Moores wrote:
>
>> So I wrote a function:
>>
>> def float2n_decimals(floatt, n):
>> """
>>
22 matches
Mail list logo