You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.3 KiB
53 lines
1.3 KiB
import xlrd
|
|
|
|
# """
|
|
# 二、读取excel文件
|
|
# """
|
|
# FilePath = 'D:/LYL/Study/Robot_framework/space/Dating-Agency/相亲用户资料.xls'
|
|
#
|
|
# # 1.打开excel文件
|
|
# wkb = xlrd.open_workbook(FilePath)
|
|
# # 2.获取sheet
|
|
# sheet = wkb.sheet_by_index(0) # 获取第一个sheet表['用户资料']
|
|
# # 3.获取总行数
|
|
# rows_number = sheet.nrows
|
|
# # 4.遍历sheet表中所有行的数据,并保存至一个空列表cap[]
|
|
# cap = []
|
|
# for i in range(1,rows_number): # 跳过表头
|
|
# x = sheet.row_values(i) # 获取第i行的值(从0开始算起)
|
|
# cap.append(x)
|
|
# print(cap)
|
|
#
|
|
#
|
|
# for Userinfo in cap:
|
|
# # U = int(Userinfo[0])
|
|
# Uname = Userinfo[0]
|
|
# Usex = Userinfo[1]
|
|
# Uhight = int(Userinfo[2])
|
|
# Uwight = int(Userinfo[3])
|
|
# Uage = int(Userinfo[4])
|
|
# Ucity = Userinfo[5]
|
|
# Uedu = Userinfo[6]
|
|
# Umarry = Userinfo[7]
|
|
# Uincome = Userinfo[8]
|
|
# Unickname = Userinfo[9]
|
|
#
|
|
|
|
"""
|
|
读取phone-text.txt文件的第一列数据
|
|
"""
|
|
phone_list = []
|
|
try:
|
|
file = open('D:/LYL/Test/ZTB/phone - test.txt', 'r')
|
|
except FileNotFoundError:
|
|
print('File is not found')
|
|
else:
|
|
lines = file.readlines()
|
|
for line in lines:
|
|
a = line.split(',')
|
|
x = a[0]
|
|
phone_list.append(x)
|
|
file.close()
|
|
|
|
for Phone in phone_list:
|
|
print(Phone)
|