Determining if a filename is greater than X characters
bignose-hates-spam at and-benfinney-does-too.id.au
Mon Aug 4 04:55:59 CEST 2003
On Sun, 03 Aug 2003 22:30:27 -0400, hokiegal99 wrote:
> How would I append a string to the end of each file that I've
The concatenation operator for strings is '+':
It would behoove you to work through the Python tutorial all the way, to
get a solid grounding in the language:
> Researching a bit on Google told me that in Python strings are
You're probably reading the word "immutable" (which, in English, means
pretty much the same thing, so the confusion is understandable).
String objects can't be changed (they are immutable), but you can bind
the name (the "variable") to a new string object, thus changing the
value referred to by the name.
Same thing happens when you perform arithmetic on a name bound to an
>>> foo = 1
>>> foo = foo + 2
What's happening here? The name 'foo' is being bound to the integer
object '1'. Then a new integer object is created with value '3' (as a
result of the arithmetic) and the name 'foo' is bound to the new object
(as a result of the assignment).
Thus, integer objects are immutable, but the name can be bound to a new
object with a different value by an assignment operation.
At the level of strings and integers, the distinction between "string
objects can be changed by assigning a new value" (incorrect) and "string
objects are immutable, assignment binds to a new object" (correct) seems
to make no difference. If you learn this, though, other aspects of
object behaviour will be much easier to understand.
\ "If you're a horse, and someone gets on you, and falls off, and |
`\ then gets right back on you, I think you should buck him off |
_o__) right away." -- Jack Handey |
Ben Finney <http://bignose.squidly.org/>
More information about the Python-list