[英]Robot Framework: How to read a random row in a csv files and use the values?
[英]Robot Framework - DataDriver - Select random data from a row within a .csv
我有一个包含大约 3k 行的电子表格,我正在尝试从(特定行)中获取 select 数据以输入表单数据。
目前,我的代码正在对 CSV 中的所有行重复测试,如何从随机行中获取 select 数据?
谢谢!
您可以轻松地在 python 中创建自己的库,用于读写 csv 文件。 这是一个适用于每个文本样式文件的快速示例。
class costomLibrary(object):
def read_specific_line(self, filename, row):
'''
This creates a keyword named "Read Specific Line"
This keyword takes the filename of the file to read and the row
wich is to be read.
'''
fp = open(filename)
for i, line in enumerate(fp):
if i == row:
return line
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.