我对 python 非常麻木。
DISPLAY 应为:surname, Firstname, Day1 ,Day2,Both Days,NoDays
我有 2 个 txt 文件。employee.txt 有以上信息。confpack 有 2 行:1. go 2. Bonus
employee.txt 是这样的:*(这写在每一行有 surname,firstname,Y,Y Surname,firtname, , Y
- Y =去空格=不去
员工:doe,john,Y, , Smith,Mary, , Y, Candy,Jim,Y,Y,
confpack 是这样的:(2 行)
我要去 奖金去
所以我有以下代码..但是无法将它们放在一起我需要将 2 个文件放在一起以显示信息。正如刚才提到的。
index = 0
prev = 0
str = Y[0]
substr = "Y"
while index < len(str):
index = str.find(substr,index)
if index == -1:
break
prev = index + len(substr)
index += len(substr)
len((str))
with open("confPack.txt", "r") as input_file2:
for line2 in input_file2:
print(" this is where: ", line2)