dear folks,
i'm trying to append a semicolon to my addr string and am using the
syntax below. for some reason the added on of the ; doesn't work.
when i print it out later on it only shows the original value of addr.
addr = incident.findNe xtSibling('td')
addr.append('%s ;')
thanks
yaffa 4 2577
yaffa wrote: dear folks,
i'm trying to append a semicolon to my addr string and am using the syntax below. for some reason the added on of the ; doesn't work. when i print it out later on it only shows the original value of addr.
addr = incident.findNe xtSibling('td') addr.append('%s ;')
Is addr is really a string? AFAIK, strings havn't an append methond.
use += to extend strings:
..>>> addr = 'abc'
..>>> addr += '%s;'
..>>> addr
'abc%s;'
--
Qiangning Hong
I'm usually annoyed by IDEs because, for instance, they don't use VIM
as an editor. Since I'm hooked to that, all IDEs I've used so far have
failed to impress me.
-- Sybren Stuvel @ c.l.python
Get Firefox!
<http://www.spreadfiref ox.com/?q=affiliates&a mp;id=67907& ;t=1>
On 12 Aug 2005 09:31:08 -0700
"yaffa" <ya*********@gm ail.com> wrote: addr = incident.findNe xtSibling('td') addr.append('%s ;')
addr += ';'
or
addr2 = '%s;' % addr
Strings, being immutable, do not support appending like lists do. Also,
the %whatever specifiers are only in effect when used with the string
formatting operator (%).
-Michael
Do not discuss off-list, maybe others will have better solutions to your
question. And also please do not top-posting, it makes me difficult to
trim the irrelevant text.
yaffa wrote: sorry addr is a variable. how to i append to that?
I know addr is a variable (or better a name). But what object do you
assign to it? I mean, does incident.findNe xtSibling('td') return a
string or an object of another type?
If your code "addr.append('% s;')" doesn't raise an exception, it is
pretty sure what assigned to addr is not a string (maybe a list, which
has an "append" method). You can use "print addr" or "print repr(addr)"
to determine that.
----- Original Message ----- From: "Qiangning Hong" <ho****@gmail.c om> To: "yaffa" <ya*********@gm ail.com> Cc: <py*********@py thon.org> Sent: Friday, August 12, 2005 12:47 PM Subject: Re: need help with my append syntax
yaffa wrote:
dear folks,
i'm trying to append a semicolon to my addr string and am using the syntax below. for some reason the added on of the ; doesn't work. when i print it out later on it only shows the original value of addr.
addr = incident.findNe xtSibling('td') addr.append('%s ;')
Is addr is really a string? AFAIK, strings havn't an append methond.
use += to extend strings:
.>>> addr = 'abc' .>>> addr += '%s;' .>>> addr 'abc%s;'
-- Qiangning Hong
I'm usually annoyed by IDEs because, for instance, they don't use VIM as an editor. Since I'm hooked to that, all IDEs I've used so far have failed to impress me. -- Sybren Stuvel @ c.l.python
Get Firefox! <http://www.spreadfiref ox.com/?q=affiliates&a mp;id=67907& ;t=1>
--
Qiangning Hong
I'm usually annoyed by IDEs because, for instance, they don't use VIM
as an editor. Since I'm hooked to that, all IDEs I've used so far have
failed to impress me.
-- Sybren Stuvel @ c.l.python
Get Firefox!
<http://www.spreadfiref ox.com/?q=affiliates&a mp;id=67907& ;t=1>
yaffa wrote: dear folks,
Dear Yaffa,
i'm trying to append a semicolon to my addr string
Python strings don't have a 'append' method.
and am using the syntax below. for some reason the added on of the ; doesn't work.
"doesn't work" is the worst possible description of a problem.
Please read http://www.catb.org/~esr/faqs/smart-questions.html
when i print it out later on it only shows the original value of addr.
addr = incident.findNe xtSibling('td') addr.append('%s ;')
If you don't have an AttributeError here then addr is not bound to a string.
thanks
yaffa
--
bruno desthuilliers
ruby -e "print 'o****@xiludom. gro'.split('@') .collect{|p|
p.split('.').co llect{|w| w.reverse}.join ('.')}.join('@' )"
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom. gro'.split('@')])" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris Reedy |
last post by:
For everyone -
Apologies for the length of this message. If you don't want to look
at the long example, you can skip to the end of the message.
And for the Python gurus among you, if you can spare the time, I
would appreciate any comments (including words like evil and disgusting,
if you think they are applicable :-}) on the example here.
Kenny -
|
by: Newbee Adam |
last post by:
I am having some problems with getting squgglie lines under stringbuilder and
ConfigurationSettings
what am I doing wrong, is this even close to working? help.
------------------------------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.VisualBasic
|
by: nephish |
last post by:
Hey there,
i have tried about every graphing package for python i can get to work
on my system. gnuplot, pychart, biggles, gdchart, etc.. (cant get
matplot to work)
so far, they all are working ok. I need to make an x y chart for some
data that comes in from sensors at different times durring the day. i
need it to show the value in the y and the time in the x . no problem
so far. But what i cannot get to happen is to scale x (time of the...
|
by: Eirik Eldorsen |
last post by:
I'm tring to translate an VB.NET method into C#. Here is what I've done so
far. Need help on the while loop
public static void SetInitialFocus(Control ctrl)
{
StringBuilder s = new StringBuilder();
s.Append("<SCRIPT LANGUAGE='JavaScript'>");
s.Append("function SetInitialFocus()");
s.Append("{");
s.Append(" document.");
|
by: Bill Borg |
last post by:
Hello,
I would like to skip over a hyperlink in the tab order. The link is not that
important, and I don't mind that they have to click to get it.
I have tried OnFocus="this.blur();" on the link, which works, but the focus
does not move to the *next* field (per the docs it's indeterminate where
blur() sends the focus, likely up to the window, which is what happens in IE).
What I think I want is the equivalent of...
| |
by: barry |
last post by:
I have the following:
function(NAMED)
{
sString.Append("document.forms.NAMED.style.visibility = 'hidden'")
}
and would like to convert the NAMED into the object it represents - for
example in this case it represents the name of an image called card17
thanks
|
by: Tomazas |
last post by:
Hi All,
I have very complex database and I am trying to build an Shaped SQL string with no success. Could anyone help me to answer how this would look like.
TABLE LIST:
Asset, Structure, Element, History
SQL should look like:
Lets make shorter Table Names:
Asset as A
Structure as S
Element as E
|
by: HMS Surprise |
last post by:
Trying not to be a whiner but I sure have trouble finding syntax in
the reference material. I want to know about list operations such as
append. Is there a pop type function? I looked in tutorial, language
reference, and lib for list, append, sequence. Is there a place where
us doofi ( who may not have our heads out in the sunlight) may find
all related syntax grouped together?
thanx,
jh
|
by: Kurda Yon |
last post by:
Hi,
I found one example which defines the addition of two vectors as a
method of a class. It looks like that:
class Vector:
def __add__(self, other):
data =
for j in range(len(self.data)):
data.append(self.data + other.data)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |