-
Python中的变量名可以包含哪些字符?
A. 字母、数字、下划线
B. 字母、数字、横线
C. 字母、数字、加号
D. 字母、数字、斜杠
答案:A -
下面哪个不是Python中的数据类型?
A. 字符串
B. 列表
C. 字典
D. 布尔
E. 所有选项都是Python中的数据类型
答案:E -
下列哪个选项可以将列表按照从小到大的顺序排序?
A. sort()
B. reverse()
C. append()
D. insert()
答案:A -
下列哪个选项可以将元组中的元素转换为列表?
A. list()
B. tuple()
C. set()
D. dict()
答案:A -
下面哪个选项可以将字符串转换为整数?
A. str()
B. float()
C. int()
D. bool()
答案:C -
下面哪个选项可以将字符串转换为小数?
A. str()
B. float()
C. int()
D. bool()
答案:B -
下面哪个选项可以将字符串转换为布尔值?
A. str()
B. float()
C. int()
D. bool()
答案:D -
下面哪个选项可以将一个列表中的所有元素连接成一个字符串?
A. join()
B. split()
C. replace()
D. append()
答案:A -
下面哪个选项可以返回一个列表中元素的数量?
A. size()
B. length()
C. count()
D. sum()
答案:B -
下面哪个选项可以返回一个字典中所有键的列表?
A. keys()
B. values()
C. items()
D. get()
答案:A -
下面哪个选项可以返回一个字典中所有值的列表?
A. keys()
B. values()
C. items()
D. get()
答案:B -
下面哪个选项可以返回一个字典中所有键值对的列表?
A. keys()
B. values()
C. items()
D. get()
答案:C -
下面哪个选项可以在Python中输出文本?
A. print()
B. input()
C. read()
D. write()
答案:A -
下面哪个选项可以从键盘读取用户输入?
A. print()
B. input()
C. read()
D. write()
答案:B -
下面哪个选项可以在Python中创建一个空列表?
A. []
B. ()
C. {}
D. set()
答案:A -
下面哪个选项可以在Python中创建一个空元组?
A. []
B. ()
C. {}
D. set()
答案:B -
下面哪个选项可以在Python中创建一个空字典?
A. []
B. ()
C. {}
D. set()
答案:C -
下面哪个选项可以在Python中创建一个空集合?
A. []
B. ()
C. {}
D. set()
答案:D -
下面哪个选项可以检查一个值是否存在于一个列表中?
A. in
B. not in
C. both A and B
D. neither A nor B
答案:C -
下面哪个选项可以检查一个键是否存在于一个字典中?
A. in
B. not in
C. both A and B
D. neither A nor B
答案:A -
下面哪个选项可以检查一个值是否存在于一个字典中?
A. in
B. not in
C. both A and B
D. neither A nor B
答案:B -
下面哪个选项可以在Python中创建一个for循环?
A. for
B. while
C. do-while
D. foreach
答案:A -
下面哪个选项可以在Python中创建一个while循环?
A. for
B. while
C. do-while
D. foreach
答案:B -
下面哪个选项可以在Python中创建一个条件语句?
A. if
B. while
C. for
D. foreach
答案:A -
下面哪个选项可以在Python中创建一个多重条件语句?
A. if
B. elif
C. else
D. all of the above
答案:D -
下面哪个选项可以在Python中创建一个函数?
A. def
B. function
C. func
D. sub
答案:A -
下面哪个选项可以在Python中调用一个函数?
A. call
B. invoke
C. execute
D. all of the above
答案:B -
下面哪个选项可以在Python中定义一个类?
A. def
B. class
C. cls
D. struct
答案:B -
下面哪个选项可以在Python中创建一个类的实例?
A. object
B. instance
C. class
D. constructor
答案:D -
下面哪个选项可以在Python中继承一个类?
A. extends
B. inherits
C. subclass
D. all of the above
答案:C -
下面哪个选项可以将两个字符串连接起来?
A. +
B. -
C. *
D. /
答案:A -
下面哪个选项可以将一个字符串重复多次?
A. +
B. -
C. *
D. /
答案:C -
下面哪个选项可以在Python中打开一个文件?
A. open()
B. close()
C. read()
D. write()
答案:A -
下面哪个选项可以在Python中关闭一个文件?
A. open()
B. close()
C. read()
D. write()
答案:B -
下面哪个选项可以在Python中读取一个文件的内容?
A. open()
B. close()
C. read()
D. write()
答案:C -
下面哪个选项可以在Python中写入内容到一个文件?
A. open()
B. close()
C. read()
D. write()
答案:D -
下面哪个选项可以在Python中删除一个文件?
A. remove()
B. delete()
C. erase()
D. all of the above
答案:A -
下面哪个选项可以在Python中创建一个新文件夹?
A. mkdir()
B. create()
C. newdir()
D. all of the above
答案:A -
下面哪个选项可以在Python中删除一个文件夹?
A. rmdir()
B. delete()
C. removedir()
D. all of the above
答案:A -
下面哪个选项可以在Python中获取当前工作目录?
A. cwd()
B. pwd()
C. dir()
D. all of the above
答案:B -
下面哪个选项可以在Python中改变当前工作目录?
A. chdir()
B. setdir()
C. changedir()
D. all of the above
答案:A -
下面哪个选项可以在Python中获取一个文件的大小?
A. size()
B. filesize()
C. getsize()
D. all of the above
答案:C -
下面哪个选项可以在Python中获取一个文件的创建时间?
A. ctime()
B. createtime()
C. getctime()
D. all of the above
答案:A -
下面哪个选项可以在Python中获取一个文件的修改时间?
A. mtime()
B. modifytime()
C. getmtime()
D. all of the above
答案:A -
下面哪个选项可以在Python中获取一个文件的访问时间?
A. atime()
B. accesstime()
C. getatime()
D. all of the above
答案:A -
下面哪个选项可以在Python中获取当前时间?
A. time()
B. current_time()
C. get_time()
D. all of the above
答案:A
[python选择题汇总1]
于 2023-06-20 18:01:00 首次发布