变量
message="Hello Python World"
print(message)
字符串
python中单、双引号括起的都是字符串
大小写
message="hello python world"
print(message.lower())#全小写
print(message.upper())#全大写
print(message.title())#首字母大写
f字符串:在字符串中使用变量
花括号中内容替代变量名
first="aa"
last="bb"
full=f"{first}{last}"
print(f"hello {full}")
制表符\t换行符\n
a="c"
b="java"
c="python"
print(f"languages:\n\t{a}\n\t{b}\n\t{c}")//\n和\t
删除空白
strip()
整数
python使用两个乘号表示乘方
浮点数
任意两个数相除 结果总是浮点数
数中的下划线
14_000和14000等价
同时给多个变量赋值
常量
python没有内置常量类型 约定将全大写的变量视为常量