String manipulation
- From: Nicholas Graham <nsgraham@xxxxxxxxxxxxxxx>
- Date: Wed, 13 Apr 2005 22:47:56 -0600
I'm writing a program that requires some string manipulations. Let's say
I have a string
s='x'
Now, the ascii code for 'x' is 0x78. I want to be able to perform
operations on this number, and print the character corresponding to the
results of the operation. For example, the pseudo-code looks like:
-read in string s from external file (for simplicity, we'll keep s='x')
-determine the code for s (should be 0x78 or 120 in base 10), store it in
variable c
-add a literal to c (let's say c=c+1)
-find out which character corresponds to the new code c=0x79
-store the character in a new string s2
At the end of this, I want s2='y'
Any suggestions?
NG
.
- Follow-Ups:
- Re: String manipulation
- From: vincent wehren
- Re: String manipulation
- Prev by Date: Re: Python 2.4 killing commercial Windows Python development ?
- Next by Date: Re: Compute pi to base 12 using Python?
- Previous by thread: Utah Python Users Group
- Next by thread: Re: String manipulation
- Index(es):
Relevant Pages
|