Double Dumbass on You wrote:
> Do you feel better about yourself for having posted a smug, shithead-type
> answer, troll??
>
> As a matter of fact, I was in a near fatal car wreck about 7 years ago.
> Suffered some brain damage. Now, I can't remember minute details such as
> that which I asked. I have read the python documentation numerous times.
> Sometimes, I just need a simple answer to a simple question, you simple
> cocksucker.
>
> GO **** YOURSELF, it will be time well spent for you.
>
> "wes weston" <> wrote in message
> news:ektPc.165630$...
>
>>Double Dumbass on You wrote:
>>
>>>I have a string that is 7 characters and represents file mode in
>
> UNIX/LINUX
>
>>>from rpm:
>>>
>>>0100755
>>>
>>>I don't care about the 0100 portion, I am only interested in the file
>>>permissions portion which is 755. How can I get three characters from
>
> the
>
>>>string starting at the right? ( -OR- strip 4 characters from the
>
> left? )
>
>>>
>>DD,
>>
>> >>> x = "0100755"
>> >>> print x[4:]
>>755
>>
>> Reading the tutorial is really time well spent.
>>wes
>>
>
>
>
DD,
I didn't mean to offend you; was trying to help.
Here's the tutorial section on slicing where word is "HelpA".
http://www.python.org/doc/2.3.4/tut/...00000000000000
--------------------------------------------------------------------------------
Strings can be subscripted (indexed); like in C, the first
character of a string has subscript (index) 0. There is no
separate character type; a character is simply a string of
size one. Like in Icon, substrings can be specified with
the slice notation: two indices separated by a colon.
>>> word[4]
'A'
>>> word[0:2]
'He'
>>> word[2:4]
'lp'
Slice indices have useful defaults; an omitted first index
defaults to zero, an omitted second index defaults to the
size of the string being sliced.
>>> word[:2] # The first two characters
'He'
>>> word[2:] # All but the first two characters
'lpA'