Haskell可以这样:
['a'..'z']
Run Code Online (Sandbox Code Playgroud)
在Python中:
map(chr, range(97, 123))
Run Code Online (Sandbox Code Playgroud)
我觉得Python很冗长.让Python像Haskell一样简单吗?
python可以在本地范围内声明全局变量吗?
有用:
def main():
# do some... for files varible
for file in files:
result = func(file)
print result
Run Code Online (Sandbox Code Playgroud)
我无法理解.有人告诉我为什么result可以在for循环外看到.
谢谢.