![]() |
I'm a new to Python
Hey guys, nice forums you have here.
Anyway I've started to learn python, today infact, as I've heard its a good language to learn, I have some experience in BASIC and a little in C from using Linux. I was wondering if there was a function in Python that did the same as mid$() in BASIC, I've searched for tutorials on string manipulation etc, but could not find anything on this function. Thanks. |
I have no experiance in BASIC, so please explain what the mid$() function does, then i can help you out.
|
Ok, i searched google and i didn't find much, from what i found i think that mid$() finds the length of a string.
In Python we have the len() function. Example 1 :
>>> len("hello"):
>>> variable = "hello" |
I think the mid function returns a part of a string. In python, you can consider a string as a list of characters and use the [] notation to get slices. See this tutorial on Python string handling or some simple code:
:
>>> s = "Hello World!" |
Quote:
returns a substring of a string :
SubStr$ = MID$("abcdefg",3,4) |
Ok, so my examples are correct to what he wants.
Thanks Dietrich for clearing that up. |
That's helped alot, thanks guys.
|
| All times are GMT -5. The time now is 2:25 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC