| Keyword/Feature |
Description |
Python Equivalent |
| Array handling |
| IsArray |
Returns True if a variable
is an array |
hasattr(obj, 'len') ?? |
| Erase |
Reinitilizes a fixed-size array |
|
| LBound |
Returns the lower bound of an
array |
0 |
| UBound |
Returns the upper bound of an
array |
len(obj) |
| Assignments |
| = |
Assigns a value to
a variable |
= |
| Let |
Assigns a value to
a variable |
Not required |
| Set |
Assigns an object
to a variable |
Not required |
| Comments |
| ` |
Includes inline comments
in your script |
# |
| Rem |
Includes comments
in your script |
# |
| Constants/Literals |
| Empty |
Indicates an uninitialized
variable |
None |
| Nothing |
Disassociates a variable with
an object |
None |
| Null |
Indicates a variable with no data |
None |
| True |
Boolean True |
True (1 pre Python 2.3) |
| False |
Boolean False |
False (0 pre Python 2.3) |
| Control flow |
| Do...Loop |
Repeats a block of
statements |
while |
| For...Next |
Repeats
a block of statements |
for |
| For Each...Next |
Repeats a block of
statements |
for |
| If...Then...Else |
Conditionally executes
statements |
if: ... else: ... |
| Select Case |
Conditionally executes
statements |
if: ... else: ... |
| While...Wend |
Repeats a block of
statements |
while |
| Conversions |
| Abs |
Returns absolute
value of a number |
abs |
| Asc |
Returns the ASCII
code of a character |
ord |
| AscB |
Returns the ASCII
code of a character |
ord ?? |
| AscW |
Returns the ASCII
code of a character |
ord ?? |
| Chr |
Returns a character
from an ASCII code |
chr |
| ChrB |
Returns a character
from an ASCII code |
chr ?? |
| ChrW |
Returns a character
from an ASCII code |
chr ?? |
| CBool |
Converts a variant
to a boolean |
bool (Python 2.3) |
| CByte |
Converts a variant
to a byte |
int |
| CDate |
Converts a variant
to a date |
time.ctime ?? |
| CDbl |
Converts a variant
to a double |
float |
| Cint |
Converts a variant
to an integer |
int |
| CLng |
Converts a variant
to a long |
long |
| CSng |
Converts a variant
to a single |
float |
| CStr |
Converts a variant
to a string |
str |
| DateSerial |
Converts a variant
to a date |
time.ctime ?? |
| DateValue |
Converts a variant
to a date |
time.ctime ?? |
| Hex |
Converts a variant
to a hex string |
hex |
| Oct |
Converts a variant
to an octal string |
oct |
| Fix |
Converts a variant
to a fixed string |
"%x.yd"
% n |
| Int |
Converts a variant
to an integer string |
int |
| Sgn |
Converts a variant
to a single string |
?? |
| TimeSerial |
Converts a variant
to a time |
?? |
| TimeValue |
Converts a variant
to a time |
?? |
| Dates/Times |
| Date |
Returns the current
date |
time module |
| Time |
Returns the current
time |
time module |
| DateSerial |
Returns a date from
its parts |
time module |
| DateValue |
Returns a date from
its value |
time module |
| Day |
Returns day from
a date |
time module |
| Month |
Returns month from
a date |
time module |
| Weekday |
Returns weekday from
a date |
time module |
| Year |
Returns year from
a date |
time module |
| Hour |
Returns hour from
a time |
time module |
| Minute |
Returns minute from
a time |
time module |
| Second |
Returns seconds from
a time |
time module |
| Now |
Returns current date
and time |
time module |
| TimeSerial |
Returns a time from
its parts |
time module |
| TimeValue |
Returns a time from
its value |
time module |
| Declarations |
| Dim |
Declares a variable |
Not possible |
| Private |
Declares script-level
private variable |
__name |
| Public |
Declares public-level
public variable |
not __name |
| ReDim |
Reallocates an array |
array |
| Function |
Declares a function |
def |
| Sub |
Declares a subprocedure |
def |
| Error Handling |
| On Error |
Enables error handling |
try |
| Err |
Contains information
about last error |
except Exception,
err |
| Input/Output |
| InputBox |
Prompts the user
for input |
raw_input / depends
on GUI |
| MsgBox |
Displays a message
to the user |
depends on GUI |
| Math |
| Atn |
Returns the Arctangent
of a number |
math.atan |
| Cos |
Returns the cosine
of a number |
math.cos |
| Sin |
Returns the sine
of a number |
math.sin |
| Tan |
Returns the tangent
of a number |
math.tan |
| Exp |
Returns the exponent
of a number |
math.exp |
| Log |
Returns the logarithm
of a number |
math.log / math.log10 |
| Sqr |
Returns the square
root of a number |
math.sqrt |
| Randomize |
Reseeds the randomizer |
random.seed |
| Rnd |
Returns a random
number |
random.random |
| Operators |
| + |
Addition |
+ |
| - |
Subtraction |
- |
| ^ |
Exponentiation |
** |
| Mod |
Modulus arithmetic |
divmod(x, y)[1] |
| * |
Multiplication |
* |
| / |
Division |
/ |
| \ |
Integer Division |
divmod(x, y)[0] |
| - |
Negation |
- |
| & |
String concatenation |
+ |
| = |
Equality |
== |
| <> |
Inequality |
<> or != |
| < |
Less Than |
< |
| <= |
Less Than or Equal
To |
<= |
| > |
Greater Than |
> |
| >= |
Greater Than or Equal
To |
>= |
| Is |
Compares expressions |
is |
| And |
Compares expressions |
and |
| Or |
Compares expressions |
or |
| Xor |
Compares expressions |
No equivalent |
| Eqv |
Compares expressions |
?? |
| Imp |
Compares expressions |
?? |
| Objects |
| CreateObject |
Creates reference
to an OLE object |
win32com.client.dis-patch |
| IsObject |
Returns True
if object is valid |
?? |
| Options |
| Option Explicit |
Forces explicit variable
declaration |
No equivalent |
| Procedures |
| Call |
Invokes a subprocedure |
name() |
| Function |
Declares a function |
def |
| Sub |
Declares a subprocedure |
def |
| Strings |
| Instr |
Returns index of
a string in another |
s.find |
| InStrB |
Returns index of
a string in another |
s.find |
| Len |
Returns the length
of a string |
len |
| LenB |
Returns the length
of a string |
len |
| Lcase |
Converts a string
to lowercase |
s.lower |
| Ucase |
Converts a string
to uppercase |
s.upper |
| Left |
Returns the left
portion of a string |
s[:n] |
| LeftB |
Returns the left
portion of a string |
s[:n] |
| Mid |
Returns the mid portion
of a string |
s[n:m] |
| MidB |
Returns the mid portion
of a string |
s[n:m] |
| Right |
Returns the right
portion of a string |
s[m:] |
| RightB |
Returns the right
portion of a string |
s[m:] |
| Space |
Pads a string with
spaces |
s.ljust |
| StrComp |
Compares two strings |
== |
| String |
Pads a string with
a character |
s += char*n |
| Ltrim |
Removes leading spaces
from a string |
?? |
| Rtrim |
Removes trailing
spaces from a string |
?? |
| Trim |
Removes leading and
trailing spaces |
s.strip |
| Variants |
| IsArray |
Returns True
if variable is an array |
hasattr(obj, 'len')
?? |
| IsDate |
Returns True
if variable is a date |
?? |
| IsEmpty |
Returns True
if variable is empty |
is None |
| IsNull |
Returns True
if variable is null. |
is None |
| IsNumeric |
Returns True
if variable is a number |
try: float(x) ?? |
| IsObject |
Returns True
if variable is an object |
No equivalent |
| VarType |
Indicates a variable's
type |
No equivalent |