零基础学习python关于赋值的一些小问题
在零基础学python中第003讲:小插曲之变量和字符串中,第1、2、3,看不太明白有大神讲解嘛 本帖最后由 jackz007 于 2020-11-10 01:06 编辑myteacher = '小甲鱼' # myteacher 指向字符串对象 '小甲鱼'
yourteacher = myteacher # yourteacher 也指向字符串对象 '小甲鱼'
yourteacher = '黑夜' # yourteacher 指向新的字符串对象 '黑夜',myteacher 依然指向字符串对象 '小甲鱼'
print(myteacher) # 打印字符串对象 '小甲鱼'
myteacher = '小甲鱼' # myteacher 指向字符串对象 '小甲鱼'
yourteacher = myteacher # yourteacher 也指向字符串对象 '小甲鱼'
myteacher = '黑夜' # myteacher 指向新的字符串对象 '黑夜',yourteacher 依然指向字符串对象 '小甲鱼'
print(yourteacher) # 打印字符串对象 '小甲鱼'
first = 520 # first 指向整型数对象 520
second = '520' # second 指向字符串对象 '520'
first = second # first 也指向字符串对象 '520' , second 依然指向字符串对象 '520'
print(first) # 打印字符串对象 '520' jackz007 发表于 2020-11-10 00:59
谢谢 谢谢 这下看懂了{:5_92:}
页:
[1]