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

Guillermo Fernandez Castellanos guillermo.fernandez.castellanos at gmail.com
Mon Nov 22 02:39:58 CET 2004


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