March 18th, 2005, 04:04 PM
Code Convert Problem
I'm having some trouble converting the following code from Visual Basic 6 to Python:
This isn't my own code but it is needed in my program and I don't understand how to translate it. Here is what I've gotten so far:
Dim aryKey(0 To 12) As String
For I = 1 To 13
aryKey(I - 1) = Mid$(sKey, I, 1)
As you will notice I left part of it, the part I didn't understand.
for item in range(1, 13):
Note: key is the argument passed to the definition that the first code I showed is in. def Key(cdkey): It is always 13 characters long and it is a string only. Thanks.
March 18th, 2005, 04:41 PM
Why bother converting anyhow? In python, strings can be accessed as individual characters.
If you want to make it a list, just because you feel like it, you can simply convert it to a list like this:
key = "abcdefghijklm"
or if you want a function
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
March 18th, 2005, 05:00 PM
Thanks again Scorpions4Ever.