好的,noob问题
我有这个代码
list = ['random', 'set', 'of', 'strings']
for item in list:
item.replace('a','b')
print list
Run Code Online (Sandbox Code Playgroud)
除非我将代码更改为此输出,否则输出不会显示替换
list = ['random', 'set', 'of', 'strings']
for item in list:
item = item.replace('a','b')
print list
Run Code Online (Sandbox Code Playgroud)
所以我的问题是到底发生了什么?为什么第一个例子没有自动分配?
当我做:
REAL FUNCTION f(x)
REAL, INTENT(IN) :: x
f = exp(-x)
END FUNCTION f
Run Code Online (Sandbox Code Playgroud)
它有效,但如果我这样做:
REAL FUNCTION f(x)
REAL, INTENT(IN) :: x
f = exp(-x^2)
END FUNCTION f
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
Error: Syntax error in argument list at (1)
Run Code Online (Sandbox Code Playgroud)
但我需要的x^2功能不是x.该怎么办?