相关试题
单选题 已知程序保存目录中,已存在文件text.txt,运行以下程序的结果是?( ) with open("test.txt", "r") as f: f.write("测试写入")
单选题 使用Python语言对SQLite数据库进行操作,下面代码空白处需填入?( ) import sqlite3
conn = sqlite3.__________ ('example.db')
cursor = conn.cursor()
cursor.execute('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)')
conn.commit()
conn.close()
单选题 关于一维数组,运行以下程序,输出结果是?( ) import numpy as n a=n.array(range(10)) print(a[5])
单选题 运行以下程序,输出结果是?( ) class A(): def __init__(self,value): self.value=value*value b=A(3) print(b.value)
单选题 已知文件test.txt与程序保存在同一个目录,其内容如下图所示,运行以下程序后,输出结果是?( ) with open("test.txt","r") as f: print(f.read())
单选题 Python类型int转换成对应的JSON类型是?( )
单选题 下面代码的输出结果正确的是?( ) import tkinter as tk root = tk.Tk() my_var = tk.StringVar() my_var.set("Hello") label = tk.Label(root, textvariable=my_var) label.pack() root.mainloop()
单选题 下面代码的输出结果正确的是?( ) import json
json_str =' [ "Alice", "girl",17,"New York"]'
data = json.loads(json_str)
print(data)