python的输入与输出:

1. python的输出:
python2: print "要打印的字符串"
python3: print("要打印的字符串")
name = "python"
print("hello %s" %(name))

python的简单输入输出格式

python的简单输入输出格式


sid = 1

 

print("hello %.3d" %(sid))

 

python的简单输入输出格式

python的简单输入输出格式

2. python的输入:
python2:
raw_input(): 接收字符串的数据;
input(): 只能接收数值;类型;


python3操作: 没有raw_input,只有input,
python3中为了避免记忆困难, 用input接收数据, 为字符串类型;


3. python中支持的数值类型: int,long,float, complex
print(type(**))可以查看变量的数据类型;

4. 数据类型的转换: 在python中, 所有的数据类型,都可以作为内置函数, 转换数据类型;

 

 

 

5. 如何删除内存中的变量;

 

 

 

aIn't= 5

print aInt

print "deleting aInt......."

del aInt

print aInt       #此时会报错,输出aInt没有定义;

 

相关文章:

  • 2021-09-19
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
  • 2021-04-02
猜你喜欢
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2021-07-02
  • 2021-12-09
  • 2021-07-21
  • 2021-11-12
相关资源
相似解决方案