Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Roy Smith wrote:
>
>>> Also, how do I do this when dealing with a file ; which file mode
>>> should I use and what function should I use to modify a single
>>> character once in that file mode?
>> This is a much more complicated question, b
In <[EMAIL PROTECTED]>, Roy Smith wrote:
>> Also, how do I do this when dealing with a file ; which file mode
>> should I use and what function should I use to modify a single
>> character once in that file mode?
>
> This is a much more complicated question, because it depends on the details
> o
Larry Bates <[EMAIL PROTECTED]> writes:
> IMHO the most elegant method is something like:
>
> def switchchar(srcstring, position, character):
> b=list(srcstring)
> b[2]=character
> return ''.join(b)
If the strings or large or you're doing it a lot, the array module is
likely more effi
mp wrote:
> X-No-Archive
> How do I go about modifying one character in a string elegantly?
> In other words, I want a function that will change '' to 'aaza',
> given the index 2 of the character in the string.
>
> Also, how do I do this when dealing with a file ; which file mode
> should I us
"mp" <[EMAIL PROTECTED]> wrote:
> X-No-Archive
> How do I go about modifying one character in a string elegantly?
> In other words, I want a function that will change '' to 'aaza',
> given the index 2 of the character in the string.
Strings are immutable, so you can't change a string. The be
mp wrote:
> X-No-Archive
> How do I go about modifying one character in a string elegantly?
> In other words, I want a function that will change '' to 'aaza',
> given the index 2 of the character in the string.
>
> Also, how do I do this when dealing with a file ; which file mode
> should I us
"mp" <[EMAIL PROTECTED]> writes:
> How do I go about modifying one character in a string elegantly?
> In other words, I want a function that will change '' to 'aaza',
> given the index 2 of the character in the string.
Ehh, there are various ways, all ugly.
x = ''
y = x[:2] + 'z' + x
X-No-Archive
How do I go about modifying one character in a string elegantly?
In other words, I want a function that will change '' to 'aaza',
given the index 2 of the character in the string.
Also, how do I do this when dealing with a file ; which file mode
should I use and what function shou