Python_函数
————————————————————————————————2016年3月14日09:21:41————————————————————————————————

    print i
    ^
IndentationError: unexpected indent

报这个 就是 你 print 的“空格”要对齐,网上 瞎JB扯淡~~!


改成:
#!/usr/bin/python
i=5
print i
i=i + 1
print i
s='''This is a multi-line string.This is the second line.'''
print s
~        

运行:
[root@localhost bayaim]# ./var.py 
5
6
This is a multi-line string.This is the second line.

———————————————————————————————————————————
Python 变量作用域(局部变量和全局变量之分):
    你也可以在局部中增加: global 变量名 (强制变成全局变量,但是,需要你程序调用函数) 

函数__返回值:
    调用后返回一个指定的值
    函数被调用后默认是none
    return 返回值
    return 执行后 函数终止
   区分返回值和打印

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-05-03
  • 2022-12-23
猜你喜欢
  • 2021-10-11
  • 2022-01-03
  • 2021-06-29
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
相关资源
相似解决方案