与 AML 函数等效的 Python 语句

在 ArcGIS 中,地理处理是执行某种工具以根据现有信息创建新信息的过程。结果通常用作后续工具的输入以实现工作流的自动化,而工作流通常包括数据管理、空间分析、数据转换任务或这三者的某种组合。从 ArcInfo Workstation 成为第一批能够提供一组丰富的 GIS 操作或命令以及一个灵活的框架(即 Arc 宏语言 (AML))来使用这些操作和命令的产品之一开始,地理处理已流行多年。

ArcGIS 9 引进了一组新的 GIS 运算符及一个使用这些运算符的新框架。由于尽量保留了名称,因此很多运算符都是 ArcInfo Workstation 用户所熟悉的,如“联合”或“裁剪”。ArcGIS 9.0 还新增了对 Python 等脚本语言的支持,从而使用非专有语言(具有比 AML 更强的功能)便可编写通常采用 AML 编写的比较复杂的工作流。

在 ArcInfo Workstation 和 ArcGIS 9 之间保留命令名称与工具名称之间的关系这一作法也已扩展到脚本编写模型中,因此许多过程实际上也是相似的。可能的话,在 ArcGIS 中保留了 AML 的易用之处,例如在工作空间中列出数据或描述数据集的属性等。目的是使所有 AML 用户都能快速掌握使用 ArcGIS 编写地理处理脚本的方法。

为协助过渡,以下等效语句概括了使用 Python 执行 AML 函数的方式。未必所有 AML 函数和指令都适用于新模型,因为某些函数与 ArcInfo Workstation 的环境直接相关(如 SHOW 函数),而其他函数(如 LISTFILE)只有 Python 自身可以更好地支持,而 ArcGIS 地理处理组件则无法支持。许多示例均结合 ArcGIS 地理处理器来使用通用的 Python 模块。

了解有关与 AML 指令等效的 Python 语句的详细信息

AML 函数的等效语句

ABS < x >

AML 函数
abs(x)

ACCESS < path >

AML 函数
import arcpy
arcpy.TestSchemaLock(path)

ACOS < x >

AML 函数
import math
math.acos(x)

AFTER < s > < search_s >

AML 函数
s[s.find(search_s) + 1:]

ANGRAD

AML 函数

<不适用>

ASIN < x >

AML 函数
import math
math.asin(x)

ATAN < x >

AML 函数
import math
math.atan(x)

ATAN2 < y > < x >

AML 函数
import math
math.atan2(y, x)

BEFORE < s > < search_s >

AML 函数
s[:s.find(search_s)]

CALC < expression >

AML 函数
import arcpy
arcpy.CalculateValue_management(expression)

CLOSE < file_unit >

AML 函数
file_unit.close()

COLUMNINFO

AML 函数

<不适用>

COPY < in > < out >

AML 函数
import arcpy
arcpy.Copy_management(in, out)

COS < x >

AML 函数
import math
math.cos(x)

CVTDISTANCE

AML 函数

<不适用>

DATE -DEFAULT

AML 函数
import time
time.strftime("%y-%m-%d", time.localtime())

DATE -FULL

AML 函数
import time
time.strftime("%y-%m-%d.%H:%M:%S.%a", time.localtime())

DATE -USA

AML 函数
import time
time.strftime("%m/%d/%y", time.localtime())

DATE -UFULL

AML 函数
import time
time.strftime("%m/%d/%y.%H:%M:%S.%a", time.localtime())

DATE -VFULL

AML 函数
import time
time.strftime("%d %b %y %H:%M:%S %A", time.localtime())

DATE -DAY

AML 函数
import time
time.strftime("%d", time.localtime())

DATE -MONTH

AML 函数
import time
time.strftime("%B", time.localtime())

DATE -YEAR

AML 函数
import time
time.strftime("%Y", time.localtime())

DATE -VIS

AML 函数
import time
time.strftime("%d %b %y", time.localtime())

DATE -TIME

AML 函数
import time
time.strftime("%H:%M:%S", time.localtime())

DATE -AMPM

AML 函数
import time
time.strftime("%I:%M %p", time.localtime())

DATE -DOW

AML 函数
import time
time.strftime("%A", time.localtime())

DATE -CAL

AML 函数
import time
time.strftime("%B %d, %Y", time.localtime())

DATE -TAG

AML 函数
import time
time.strftime("%y%m%d", time.localtime())

DATE -FTAG

AML 函数
import time
time.strftime("%y%m%d.%H%M%S", time.localtime())

DATE -DFMT

AML 函数
import time
time.strftime(s, time.localtime())
# Format string (s) using below
#   %% same as % 
#   %a day of week, using locale's abbreviated weekday names 
#   %A day of week, using locale's full weekday names 
#   %b,%h month, using locale's abbreviated month names 
#   %B month, using locale's full month names #%c date and time as %x %X 
#   %d day of month (01-31) 
#   %H hour (00-23) 
#   %I hour (00-12) 
#   %j day number of year (001-366) 
#   %m month number (01-12) 
#   %M minute (00-59) 
#   %p locale's equivalent of AM or PM, whichever is appropriate 
#   %r time as %I:%M:%S %p 
#   %S seconds (00-59) 
#   %U week number of year (01-52), Sunday is the first day of the week 
#   %w day of week; Sunday is day 0 
#   %W week number of year (01-52), Monday is the first 
#   %x date, using locale's date format 
#   %X time, using locale's time format 
#   %y year within century (00-99) 
#   %Y year, including century (for example, 1994) 
#   %Z time zone abbreviation

DELETE < path >

AML 函数
import arcpy
arcpy.Delete_management(path)

DIGNUM

AML 函数

<不适用>

DIR < file >

AML 函数
import os
os.path.dirname(file)

ENTRYNAME < file > -EXT

AML 函数
import os
os.path.basename(file)

ENTRYNAME < file > -NOEXT

AML 函数
import os
os.path.splitext(file)[0]

ENTRYNAME < file > -EXTONLY

AML 函数
import os
os.path.splitext(file)[1]

EXISTS < file >

AML 函数
import arcpy
arcpy.Exists(file)

EXP < x >

AML 函数
import math
math.exp(x)

EXTRACT < pos > < elements >

AML 函数
#elements are blank separated
elements.split()[pos - 1]

EXTRACT < pos > < elements >

AML 函数
#elements are comma separated
elements.split(",")[pos - 1]

FILELIST

AML 函数

<不适用>

FORMAT < format > { exp1 exp2 }

AML 函数
"First %s, second %s" % (exp1, exp2)

FORMATDATE

AML 函数

<不适用>

GETCHAR < prompt >

AML 函数
raw_input(prompt)

GETCHOICE < choices > < prompt > <-SORT>

AML 函数
from Tkinter import *
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

list = choices.split()
list.sort()
print PopupList(prompt, list)

GETCOVER < workspace > < wildcard > < prompt > <-SORT>

AML 函数
from Tkinter import *
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

import arcpy

arcpy.env.workspace = workspace

list = arcpy.ListDatasets(wildcard, "cover")
list.sort()
print PopupList(prompt, list)

GETDATABASE

AML 函数

<不适用>

GETDATALAYER

AML 函数

<不适用>

GETDEFLAYERS

AML 函数

<不适用>

GETFILE < wildcard > <-INFO> < prompt > <-SORT>

AML 函数
# Assumes arcpy.env.workspace is set
#
from Tkinter import *
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

import arcpy

list = arcpy.ListTables(wildcard, "INFO")
list.sort()
print PopupList(prompt, list)

GETFILE < wildcard > <-WORKSPACE> < prompt > <-SORT>

AML 函数
# Assumes arcpy.env.workspace is set
#
from Tkinter import *
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

import arcpy

list = arcpy.ListWorkspaces(wildcard, "COVERAGES")
list.sort()
print PopupList(prompt, list)

GETFILE <wildcard> <-FILE> < prompt > <-SORT>

AML 函数
# Assumes arcpy.env.workspace is set
#
from Tkinter import *
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

import arcpy
import dircache
import os

list = arcpy.ListFiles()
list.sort()
print PopupList(prompt, list)

GETFILE <wildcard> <-DIRECTORY> < prompt > <-SORT>

AML 函数
# Assumes arcpy.env.workspace is set
#
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

import arcpy 
import dircache
import os

list = arcpy.ListFiles()
list.sort()
print PopupList(prompt, list)

GETGRID < workspace > < wildcard > < prompt > <-SORT>

AML 函数
from Tkinter import *
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

import arcpy

arcpy.env.workspace = workspace

list = arcpy.ListRasters(wildcard, "GRID")
list.sort()
print PopupList(prompt, list)

GETIMAGE < workspace > < wildcard > < type > < prompt > <-SORT>

AML 函数
# Type mapping:
#  -ALL use "" (blank)
#  -BMP use bmp
#  -TIFF use tiff
#  -IMAGINE use img	

from Tkinter import *
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

import arcpy

arcpy.env.workspace = workspace

list = arcpy.ListRasters(wildcard, type)
list.sort()
print PopupList(prompt, list)

GETITEM < path > < prompt > <-SORT>

AML 函数
from Tkinter import *
def PopupList(title, list):
	root = Tk()
	root.title(title)
	root.protocol("WM_DELETE_WINDOW", root.quit)
	frame = Frame(root)
	vScrollbar = Scrollbar(frame, orient=VERTICAL)
	hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
	listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
	vScrollbar.config(command=listbox.yview)
	vScrollbar.pack(side=RIGHT, fill=Y)
	hScrollbar.config(command=listbox.xview)
	hScrollbar.pack(side=BOTTOM, fill=Y)
	listbox.pack(side=LEFT, fill=BOTH, expand=1)
	frame.pack()
	for a in list:
		listbox.insert(END, a)
		listbox.bind("<Double-Button-1>", PopupList_callback)
		listbox.selection_set(0)
	root.mainloop()
	index = listbox.curselection()
	entry = listbox.get(index)
	root.destroy()
	return entry
def PopupList_callback(event):
        event.widget.quit()

import arcpy

list = []
pFields = arcpy.ListFields(path)
for field in pFields:
        list.append(pField.name)
list.sort()
print PopupList(prompt, list)

GETLAYERCOLS

AML 函数

<不适用>

GETLIBRARY

AML 函数

<不适用>

GETSTACK

AML 函数

<不适用>

GETSYMBOL

AML 函数

<不适用>

GETTIN < workspace > < wildcard > < prompt > <-SORT>

AML 函数
from Tkinter import *
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

import arcpy

arcpy.env.workspace = workspace

list = arcpy.ListDatasets(wildcard, "tin")
list.sort()
print PopupList(prompt, list)

GETUNIQUE < path > < item > < prompt >

AML 函数
from Tkinter import *
def PopupList(title, list):
    root = Tk()
    root.title(title)
    root.protocol("WM_DELETE_WINDOW", root.quit)
    frame = Frame(root)
    vScrollbar = Scrollbar(frame, orient=VERTICAL)
    hScrollbar = Scrollbar(frame, orient=HORIZONTAL)
    listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set)
    vScrollbar.config(command=listbox.yview)
    vScrollbar.pack(side=RIGHT, fill=Y)
    hScrollbar.config(command=listbox.xview)
    hScrollbar.pack(side=BOTTOM, fill=Y)
    listbox.pack(side=LEFT, fill=BOTH, expand=1)
    frame.pack()
    for a in list:
        listbox.insert(END, a)
    listbox.bind("<Double-Button-1>", PopupList_callback)
    listbox.selection_set(0)
    root.mainloop()
    index = listbox.curselection()
    entry = listbox.get(index)
    root.destroy()
    return entry
def PopupList_callback(event):
    event.widget.quit()

import arcpy

list = []
rows = arcpy.SearchCursor(path)
for row in rows:
    list.append(row.GetValue(item))

del row
del rows

list.sort()
count = len(list)
pos = 1
prev = list[0]
while pos < count:
    if prev == list[pos]:
        del(list[pos])
        count = count - 1
    else:
        prev = list[pos]
        pos = pos + 1
print PopupList(prompt, list)

IACCLOSE

AML 函数

<不适用>

IACCONNECT

AML 函数

<不适用>

IACDISCONNECT

AML 函数

<不适用>

IACOPEN

AML 函数

<不适用>

IACREQUEST

AML 函数

<不适用>

INDEX < s > < search >

AML 函数
s.find(search) + 1

INVANGLE < x1 y1 x2 y2 >

AML 函数
import math
dx = x2 - x1
dy = y2 - y1
if dx == 0.0 and dy == 0.0:
    angle = 0
else:
    angle = math.atan2(math.fabs(dy), math.fabs(dx))
    if dx < 0.0:
        angle = 180.0 - angle
    if dy < 0.0:
        angle = 360.0 - angle

INVDISTANCE < x1 y1 x2 y2 >

AML 函数
import math
dist = math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))

ITEMINFO < specifier > < item >

AML 函数
import arcpy

fields = arcpy.ListFields(specifier)
for field in fields:
    if field.name.lower() ==  item.lower():
        print field.name
        print field.length
        break

JOINFILE < obj1 > < obj2 > -file -sub

AML 函数
import os
os.path.join(obj1, obj2)

JOINFILE < obj1 > < obj2 >-ext

AML 函数
if obj2[0] == ".":
    obj1+ obj2
else:
    obj1 + "." + obj2

LENGTH < string >

AML 函数
len(string)

LISTFILE

AML 函数

<不适用>

LISTITEM < specifier >

AML 函数
import arcpy
fieldNames = []
fields = arcpy.ListFields(specifier)
for field in fields:
    fieldNames.append(field.name)

LISTUNIQUE < specifier > < item >

AML 函数
import arcpy

list = []
rows = arcpy.SearchCursor(specifier)
for row in rows:
    list.append(row.GetValue(item))

del row
del rows

list.sort()
count = len(list)
pos = 1
prev = list[0]
while pos < count:
    if prev == list[pos]:
        del(list[pos])
        count = count - 1
    else:
        prev = list[pos]
        pos = pos + 1

LOCASE < s >

AML 函数
s.lower()

LOG < x >

AML 函数
import math
math.log(x)

LOG10 < x >

AML 函数
import math
math.log10(x)

MAX < x > < y >

AML 函数
max(x, y)

MENU

AML 函数

<不适用>

MIN < x > < y >

AML 函数
min(x, y)

MOD < x > < y >

AML 函数
x % y

NULL < string >

AML 函数
if string == None or string.strip() == "":
    ".TRUE."
else:
    ".FALSE."

OKANGLE

AML 函数

<不适用>

OKDISTANCE

AML 函数

<不适用>

OPEN < file > -READ

AML 函数
f = open(file, "r")

OPEN < file > -WRITE

AML 函数
f = open(file, "w")

OPEN < file > -APPEND

AML 函数
f = open(file, "a")

PATHNAME < file >

AML 函数
# Assumes arcpy.env.workspace is set
#
import arcpy
import os

os.path.join(arcpy.env.workspace, file)

QUERY

AML 函数

<不适用>

QUOTE

AML 函数

<不适用>

QUOTEEXISTS

AML 函数

<不适用>

RADANG

AML 函数

<不适用>

RANDOM

AML 函数
import random
random.randint(1, 2**31 - 1)

RANDOM < seed >

AML 函数
import random
random.seed(seed)
random.randint(1, 2**31 - 1)

RANDOM < begin > < end >

AML 函数
import random
random.randint(begin, end)

RANDOM < seed > < begin > < end >

AML 函数
import random
random.seed(seed)
random.randint(begin, end)

READ <f ile_unit >

AML 函数
file_unit.readline()

RENAME < in > < out >

AML 函数
import arcpy

arcpy.Rename_management(in, out)

RESPONSE < prompt > -NOECHO

AML 函数
import getpass
getpass.getpass(prompt)

RESPONSE < prompt >

AML 函数
import getpass
getpass.default_getpass(prompt)

ROUND < n >

AML 函数
long(round(n))

SCRATCHNAME

AML 函数
import arcpy

# Assumes arcpy.env.workspace is already set
arcpy.CreateScratchName()

SEARCH < s > < search_s >

AML 函数
s.find(search_s) + 1

SHOW

AML 函数

<不适用>

SIN < x >

AML 函数
import math
math.sin(x)

SORT < elements > -ASCEND

AML 函数
# Elements are blank separated
#
list = elements.split()
list.sort()

SORT < elements > -DESCEND

AML 函数
# Elements are blank separated
#
list = elements.split()
list.sort(None, None, True)

SORT < elements > -ASCEND

AML 函数
# Elements are comma separated
#
list = elements.split(",")
list.sort()

SORT < elements > -DESCEND

AML 函数
# Elements are comma separated
#
list = elements.split(",")
list.sort(None, None, True)

SQRT < x >

AML 函数
import math
math.sqrt(x)

SUBST < s > < search_s > < replace_s >

AML 函数
s.replace(search_s, replace_s)

SUBST < s > < search_s >

AML 函数
s.replace(search_s, "")

SUBSTR < s > < pos >

AML 函数
s[pos - 1:]

SUBSTR < s > < pos > < num_chars >

AML 函数
s[pos - 1:pos + num_chars - 1]

TAN < x >

AML 函数
import math
math.tan(x)

TASK

AML 函数

<不适用>

TOKEN < elements > -COUNT

AML 函数
# Elements are blank separated
#
len(elements.split()) 

TOKEN < elements > -FIND < e >

AML 函数
# Elements are blank separated
#
elements.split().index(e) + 1

TOKEN < elements > -MOVE < from > < to >

AML 函数
# Elements are blank separated
#
list = elements.split()
list.insert(To-1, list[From-1])
del(list[To])

TOKEN < elements > -INSERT < pos > < s >

AML 函数
# Elements are blank separated
#
list = elements.split()
list.insert(pos-1,s)

TOKEN < elements > -DELETE < pos >

AML 函数
# Elements are blank separated
#
list = elements.split()
del(list[pos-1])

TOKEN < elements > -REPLACE < pos > < s >

AML 函数
# Elements are blank separated
#
list = elements.split()
list[pos-1] = s

TOKEN < elements > -MOVE <from> <to>

AML 函数
# Elements are blank separated
#
list = elements.split()
fvalue = list[From-1]
tvalue = list[To-1]
list[From-1] = tvalue
list[To-1] = fvalue

TOKEN < elements > -COUNT

AML 函数
# Elements are comma separated
#
len(elements.split("")) 

TOKEN < elements > -FIND < e >

AML 函数
# Elements are comma separated
#
elements.split().index(e) + 1

TOKEN < elements > -MOVE <from> <to>

AML 函数
# Elements are comma separated
#
list = elements.split("")
list.insert(To-1, list[From-1])
del(list[To])

TOKEN <elements> -INSERT <pos> <s>

AML 函数
# Elements are comma separated
#
list = elements.split("")
list.insert(pos-1,s)

TOKEN < elements > -DELETE < pos >

AML 函数
# Elements are comma separated
#
list = elements.split("")
del(list[pos-1])

TOKEN < elements > -REPLACE <pos> <s>

AML 函数
# Elements are comma separated
#
list = elements.split("")
list[pos-1] = s

TOKEN < elements > -MOVE < from > < to >

AML 函数
# Elements are comma separated
#
list = elements.split("")
fvalue = list[From-1]
tvalue = list[To-1]
list[From-1] = tvalue
list[To-1] = fvalue

TRANSLATE < string >

AML 函数
string.upper()

TRANSLATE < string > < new old >

AML 函数
for i in old:
    if string.find(i) > -1:
        string = string.replace(i,new[old.find(i)])

TRIM <s> -BOTH < trim_char >

AML 函数
s.strip(trim_char)

TRIM <s> -LEFT < trim_char >

AML 函数
s.lstrip(trim_char)

TRIM <s> -RIGHT < trim_char >

AML 函数
s.rstrip(trim_char)

TRIM < s > -BOTH

AML 函数
s.strip()

TRIM < s > -LEFT

AML 函数
s.lstrip()

TRIM < s > -RIGHT

AML 函数
s.rstrip()

TRUNCATE < x >

AML 函数
long(x)

TYPE < object >

AML 函数
type(object)

UNQUOTE

AML 函数

<不适用>

UPCASE < s >

AML 函数
s.upper()

USERNAME

AML 函数
import getpass
getpass.getuser()

VALUE

AML 函数

<不适用>

VARIABLE

AML 函数

<不适用>

VERIFY < search_string > < string >

AML 函数
count = 0
for i in range(len(search_string)):
    if string.find(search_string[i]) == -1:
        count = i + 1
        break

WRITE < file_unit > < string >

AML 函数
file_unit.write(string)

相关主题


7/10/2012