# f-string还能在花括号里直接计算 print(f"再过5年我{age + 5}岁,存款翻10倍就有{money * 10:.1f}元")f-string的花括号里不光能放变量,还能写表达式、调用函数,甚至还能嵌套字典取值。写起来比%格式化和format()方法都简单。记住在字符串前面加个f,然后用花括号{}包住想要格式化的内容就行。这个特
>>> intab = "aeiou" #This is the string having actual characters. >>> outtab = "12345" #This is the string having corresponding mapping character >>> trantab = str.maketrans(intab, outtab) >>> >>> str = "this is string example...wow!!!" >>> str.translate(trantab) 'th3s ...
turtle.pensize():设置线条粗细 turtle.fillcolor(colorstring):绘制图形的填充颜色 turtle.color(color1,color2):同时设置pencolor=color1,fillcolor=color2,要在画之前,第一个是画笔颜色,第二个是填充颜色 turtle.begin_fill():准备开始填充 turtle.end_fill():填充完成 turtle.filling():返回当前是否在填充状态 ...