thanks everyone for all the ideas -- simple stuff, I know for you all,
but very helpful for me.
--
http://mail.python.org/mailman/listinfo/python-list
MRAB wrote:
noydb wrote:
If I have a string for a file name such that I want to find the number
of characters to the left of the dot, how can that be done?
I did it this way:
x = "text12345.txt"
dot = x.find('.')
print dot
Was curious to see what method others would use - helps me learn. I
gu
On Jun 30, 6:27 pm, noydb wrote:
> If I have a string for a file name such that I want to find the number
> of characters to the left of the dot, how can that be done?
>
> I did it this way:
> x = "text12345.txt"
> dot = x.find('.')
> print dot
>
> Was curious to see what method others would use -
On 6/30/2009 1:43 PM nn said...
On Jun 30, 1:56 pm, MRAB wrote:
>>> len("text12345.txt".split(".", 1)[0])
9
>>> len("textstringwithoutdot".split(".", 1)[0])
20
Also:
>>> len("text.12345.txt".partition('.')[0])
4
>>> len("text.12345.txt".rpartition('.')[0])
10
>>>
unless you've got fi
On Jun 30, 1:56 pm, MRAB wrote:
> noydb wrote:
> > If I have a string for a file name such that I want to find the number
> > of characters to the left of the dot, how can that be done?
>
> > I did it this way:
> > x = "text12345.txt"
> > dot = x.find('.')
> > print dot
>
> > Was curious to see wh
noydb wrote:
If I have a string for a file name such that I want to find the number
of characters to the left of the dot, how can that be done?
I did it this way:
x = "text12345.txt"
dot = x.find('.')
print dot
Was curious to see what method others would use - helps me learn. I
guess I was mos
If I have a string for a file name such that I want to find the number
of characters to the left of the dot, how can that be done?
I did it this way:
x = "text12345.txt"
dot = x.find('.')
print dot
Was curious to see what method others would use - helps me learn. I
guess I was most curious to se