- 博客(5)
- 收藏
- 关注
原创 .format报错:SyntaxError: invalid syntax
看小甲鱼视频学习format 在powershell输入 “I hate {0} and {1}”.format{“you”,“me”} 报错SyntaxError: invalid syntax. 将后面大括号改为圆括号: “I hate {0} and {1}”.format(“you”,“me”) 输出字符串:‘I hate you and me’ ...
2019-02-07 12:29:27
1087
原创 Learn python3 the hard way-ex22
小结: 1.Print(“”)打印双引号内的内容;print(“”,数字运算/逻辑判断)打印出双引号内容+数字结果/true或false;当然print(‘A’)可以输出A;Print(“”“ABC”“”)是为了面对ABC内容太多而设计的,输入三个双引号在输入ABC时可换行。 2.Print(数字运算)打印出运算的结果;print(逻辑判断)打印出true/false; 3. print(“...
2018-09-08 20:47:19
253
原创 Learn python 3 the hard way-ex21
1、敲的代码如下。 def add(a, b): print(f"ADDING {a}+{b}") return a+b def subtract(a, b): print(f"SUBTRACTING {a} - {b}") return a - b def multiply(a, b): print(f"MULTIPLYING {a} * {b}")...
2018-09-06 17:10:33
204
原创 Learn python 3 the hard way-ex20
敲的代码如下: from sys import argv script, input_file = argv # define a function to print the contents of a file def print_all(f): # print out the contents of a file print(f.read()) def rewind(f): # ...
2018-09-06 16:19:06
185
原创 Learn python the hard way--ex18
Learn python the hard way–Ex.18 敲的代码如下: # this one is like your scripts with argv def print_two (*args): arg1, arg2 = args print(f"arg1: {arg1}, arg2: {arg2}") # ok.that *args is actually p...
2018-09-06 11:41:17
210
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人