python全局变量修改
程序员文章站
2024-01-22 19:27:10
...
n=1
ls=[]
def test1():
global n #用global可以修改全局变量
n=5
test1()
print("the number is :",n)
def test2():
for i in range(10):
ls.append(i) #函数内可以直接修改 列表的值
test2()
print("the list is :",ls)
上一篇: php生成缩略图,加水印种
下一篇: php登陆页面,该如何解决