小编Ale*_*lex的帖子

将CSV文件的内容转换为字典

到目前为止我的代码是一个基本上读取csv文件并打印其内容的函数:

def read(filename):
    with open(filename, 'r') as csvfile:
        reader = csv.reader(csvfile, delimiter=',')
        for row in reader:
            print(row)
Run Code Online (Sandbox Code Playgroud)

内容sailor.csv:

name, mean performance , std dev
Alice, 100, 0,
Bob, 100, 5,
Clare, 100, 10,
Dennis, 90, 0,
Eva, 90, 5,
Run Code Online (Sandbox Code Playgroud)

read('sailor.csv') 并运行该功能

电流输出:

['name', ' mean performance ', ' std dev']
['Alice', ' 100', ' 0', '']
['Bob', ' 100', ' 5', '']
['Clare', ' 100', ' 10', '']
['Dennis', ' 90', ' 0', '']
['Eva', ' 90', ' …
Run Code Online (Sandbox Code Playgroud)

python csv dictionary function

6
推荐指数
2
解决办法
2228
查看次数

Access - VB中行分隔"&_"和"_"之间的区别

我似乎无法找到任何具体的内容.我知道,为了将一段代码分成多行,只需在行尾添加"_"即可.

但是,我注意到我的一些代码行仅在我使用"&_"时才有效,而下一行包含一组额外的语音标记,如果在一行上则不包括它们,为什么这是?

代码在一行:

Msg1 = MsgBox("Removing an LPA will remove ALL of their details from the database, including their documents - You cannot undo this action. Do you wish to continue?", vbYesNo, "WARNING!")
Run Code Online (Sandbox Code Playgroud)

代码行分开工作:

Msg1 = MsgBox("Removing an LPA will remove ALL of their details from the database," & _
"including their documents - You cannot undo this action. Do you wish to" & _
" continue?", vbYesNo, "WARNING!")
Run Code Online (Sandbox Code Playgroud)

分隔的代码行不起作用:

Msg1 = MsgBox("Removing an LPA will …
Run Code Online (Sandbox Code Playgroud)

ms-access vba access-vba

2
推荐指数
1
解决办法
9561
查看次数

标签 统计

access-vba ×1

csv ×1

dictionary ×1

function ×1

ms-access ×1

python ×1

vba ×1