• 2022-05-30
    python中,下列不可以作为变量命名的是
    A: Fo
    B: fo
    C: hello
    D: HELLO
  • B

    内容

    • 0

      已知字符串 x = 'hello Python',那么执行语句 x.replace('hello', 'hi') 之后,x的值为____________。 A: 'hi Python' B: 'hello Python' C: hello Python D: hi Python

    • 1

      以下不是Python语言合法变量的是( )。 A: _a B: sum_int C: fo D: 分数

    • 2

      下列代码中能够正确实现追加写入的是( )。 A: with open("d:\\python\\data.txt",'w') as f: f.write('Hello!') B: with open("d:\\python\\data.txt",'a') as f: f.write('Hello!') C: with open("d:\\python\\data.txt",'r+') as f: f.write('Hello!') D: with open("d:\\python\\data.txt",'wb+') as f: f.write('Hello!')

    • 3

      ‌以下程序的输出结果是:( )‏‌fo = open("text.txt",'w+')‏‌x,y ='this is a test','hello'‏‌fo.write('{}+{}\n'.format(x,y))‏‌print(fo.read())‏‌fo.close()‏‌‏ A: this is a test hello B: this is a test C: this is a test,hello. D: this is a test+hello

    • 4

      下列关于Python中函数定义的代码正确的是?() A: def say_hello: print(Hello) B: def say_helloprint(Hello) C: def say_hello: print(Hello) D: def say_hello:print(Hello)