• 笨方法学python--读文件

    时间:2022-06-14 08:24:18

    1raw_input()的另外用法prompt='>'likes=raw_input(prompt)提示符>可以不用每次输入,要修改,只修改一个地方。2读取文件txt=open(filename)调用read函数txt.read()txt本身不是文件内容,而是文件对象。即外包装,包着文件...

  • 笨方法学python--打印

    时间:2022-04-07 04:59:03

    1print语句尾端的逗号end1="C"end2="h"end3="e"end4="e"end5="s"end6="e"end7="B"end8="u"end9="r"end10="g"end11="e"end12="r"#watchthatcommaattheend.tryremovingitt...

  • 《笨方法学Python》加分题35

    时间:2021-12-05 03:05:53

    sys.exit用于结束程序fromsysimportexit#进入黄金房间后的逻辑defgold_room():print("Thisroomisfullofgold.Howmuchdoyoutake?")choice=input(">")#如果输入不包含0或1则死if""inchoiceo...

  • 笨方法学Python 习题 5: 更多的变量和打印

    时间:2021-10-21 03:15:42

    #!usr/bin/python#-*-coding:utf8-*-my_name="ZedA.Shaw"my_age=35#notaliemy_height=74#inchesmy_weight=180#lbsmy_eyes="Blue"my_teeth="White"my_hair="Brown...