What does this operator do? Specifically in this context
test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
(Tried googling and searching, but the "%" gets interpreted as an
operation and distorts the search results) 9 6831
The percent sign is a placeholder.
For example, if
level = 1
msg = 'look'
Then
'[[Log level %d: %s]]' % ( level, msg )
becomes
'[[Log level 1: look]]'
%d means insert an integer
%s means insert a string
You can also use dictionaries.
d = {'string1': 'hey', 'string2': 'you'}
Then
'%(string1)s %(string2)s' % d
becomes 'hey you'
On Thu, Jul 17, 2008 at 10:33 AM, korean_dave <da*********@gmail.comwrote:
What does this operator do? Specifically in this context
test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
(Tried googling and searching, but the "%" gets interpreted as an
operation and distorts the search results)
-- http://mail.python.org/mailman/listinfo/python-list
korean_dave wrote:
What does this operator do? Specifically in this context
test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
(Tried googling and searching, but the "%" gets interpreted as an
operation and distorts the search results)
Having seen a number of comments like this over the years (about the
difficulty of searching for symbol meanings), I just started, last
night, a symbol index listing nearly all Python syntax uses of
non-alpha-or-digit ascii symbols. When I finish and upload it
somewhere, I will post an announcement with the link.
tjr
Terry Reedy wrote:
>
korean_dave wrote:
>What does this operator do? Specifically in this context
test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
(Tried googling and searching, but the "%" gets interpreted as an operation and distorts the search results)
Having seen a number of comments like this over the years (about the
difficulty of searching for symbol meanings), I just started, last
night, a symbol index listing nearly all Python syntax uses of
non-alpha-or-digit ascii symbols. When I finish and upload it
somewhere, I will post an announcement with the link.
tjr
-- http://mail.python.org/mailman/listinfo/python-list
I thought, in this contexted, it was mapping operator.
sph
On Jul 17, 3:42*pm, Terry Reedy <tjre...@udel.eduwrote:
korean_dave wrote:
What does this operator do? Specifically in this context
test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
(Tried googling and searching, but the "%" gets interpreted as an
operation and distorts the search results)
Having seen a number of comments like this over the years (about the
difficulty of searching for symbol meanings), I just started, last
night, a symbol index listing nearly all Python syntax uses of
non-alpha-or-digit ascii symbols. *When I finish and upload it
somewhere, I will post an announcement with the link.
tjr
That sounds great Terry! I look forward to seeing this.
~Jordan
Steven Howe <ho*********@gmail.comwrote:
>Terry Reedy wrote:
>> korean_dave wrote:
>>What does this operator do? Specifically in this context
test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
I thought, in this contexted, it was mapping operator.
What??
Python does not have a "mapping operator". It has a "map" function, but no
equivalent operator.
% is either the string formatting operator (when the left-hand operand is a
string) or the modulo operator (when the left-hand operand is a number).
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Tim Roberts wrote:
Steven Howe <ho*********@gmail.comwrote:
>Terry Reedy wrote:
>>korean_dave wrote: What does this operator do? Specifically in this context
test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
I thought, in this contexted, it was mapping operator.
You miss clipped. I never wrote that. Please be careful, especially
about attributing mis-information.
What??
Python does not have a "mapping operator". It has a "map" function, but no
equivalent operator.
% is either the string formatting operator (when the left-hand operand is a
string) or the modulo operator (when the left-hand operand is a number).
Which I learned 10 years ago. What I did write was a pre-announcement
of a Python symbol glossary, which I just finished a first draft of.
And now to bed ;-)
Terry Reedy wrote:
>
korean_dave wrote:
>What does this operator do? Specifically in this context
test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
(Tried googling and searching, but the "%" gets interpreted as an operation and distorts the search results)
Having seen a number of comments like this over the years (about the
difficulty of searching for symbol meanings), I just started, last
night, a symbol index listing nearly all Python syntax uses of
non-alpha-or-digit ascii symbols. When I finish and upload it
somewhere, I will post an announcement with the link.
tjr
This will be excellent, Terry.
For the present case, perhaps we should also point out that in
python 3.0:
" Note
The formatting operations described here are obsolete and may go away in
future versions of Python. Use the new String Formatting in new code."
(Taken from the provisional documentation at: http://docs.python.org/dev/3.0/libra...ing-formatting
)
Terry Reedy <tj*****@udel.eduwrote:
> Tim Roberts wrote:
>Steven Howe <ho*********@gmail.comwrote:
>>Terry Reedy wrote: korean_dave wrote: What does this operator do? Specifically in this context > test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
I thought, in this contexted, it was mapping operator.
You miss clipped. I never wrote that. Please be careful, especially about attributing mis-information.
If you count the signs, you'll see that I correctly attributed the
question to korean_dave, and the answer to Steve Howe. Steve's reply
contained your name, but there was no text from you in my post.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sarmin |
last post by:
Hi Pythoners...
It seems to me the Asterisk (*) sign in python means many things...
if a python code line looks like this:
def__init__(self, func, *param):
bla bla bla...
and then u have...
|
by: Mark Hahn |
last post by:
We are considering switching to the dollar sign ($) for self, instead of the
period ( . ) we are using now in Prothon. Ruby uses the at-sign (@) for
self, but our new usage of self also includes...
|
by: Blake T. Garretson |
last post by:
I want to save some sensitive data (passwords, PIN numbers, etc.) to
disk in a secure manner in one of my programs. What is the
easiest/best way to accomplish strong file encryption in Python? ...
|
by: gyromagnetic |
last post by:
The following url points to an article written by Damian Conway
entitled "Ten Essential Development Practices":
http://www.perl.com/pub/a/2005/07/14/bestpractices.html
Althought the article has...
|
by: jantod |
last post by:
I think there might be something wrong with the implementation of
modulus.
Negative float values close to 0.0 break the identity "0 <= abs(a % b)
< abs(b)".
print 0.0 % 2.0 # => 0.0
print...
| |
by: Kurt B. Kaiser |
last post by:
Patch / Bug Summary
___________________
Patches : 407 open ( +3) / 3393 closed (+17) / 3800 total (+20)
Bugs : 888 open (+28) / 6145 closed (+14) / 7033 total (+42)
RFE : 232 open...
|
by: yrogirg |
last post by:
Actually, I need utf-8 to utf-8 encoding which would change the text
to another keyboard layout (e.g. from english to russian ghbdtn ->
ÐÒÉ×ÅÔ) and would not affect other symbols.
I`m totally...
|
by: Marcin Jurczuk |
last post by:
Hello,
I'm fighting with Certificate Authority functionality with python
I stuck on following problem: How to sign CSR using CA key and write
resulted certificate.
You can do it using following...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |