[Tutor] trying to find the python equivalent for VB6 "left", "right" and "mid"

Fabian von Berlepsch fabian at berlepsch.de
Mon Nov 22 02:44:54 CET 2004


Thank you so much - you can not imagine how much you helped me with your
response!

Thank you again, 
Fabian

-----Message d'origine-----
De : Guillermo Fernandez Castellanos
[mailto:guillermo.fernandez.castellanos at gmail.com] 
Envoyé : lundi 22 novembre 2004 02:40
À : Fabian von Berlepsch
Cc : tutor at python.org
Objet : Re: [Tutor] trying to find the python equivalent for VB6 "left",
"right" and "mid"

hi,

I can think of this:
>>> mystring = "Hello world"
>>> print mystring[:7]
Hello w
>>> print mystring[7:]
orld
>>> print mystring[1:9]
ello wor

Regards,

Guille


On Mon, 22 Nov 2004 02:28:38 +0100, Fabian von Berlepsch
<pub at berlepsch.de> wrote:
> Hallo Guys,
> 
> I am almost having a nerve crisis!
> Since 3 hours I am trying to find the python equivalent for VB6 "left",
> "right" and "mid".
> 
> Example (what I am looking for):
> 
> >>> mystring = "Hello world"
> 
> >>> print left(mystring,7)
> 
> Hello w
> 
> - or -
> 
> >>> mystring = "Hello world"
> 
> >>> print mid(mystring,2,8)
> 
> ello wor
> 
> --------------------------
> 
> You see?
> Thank you so much for getting me out of that mess!
> 
> Fabian
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>




More information about the Tutor mailing list