我有一个包含相同模式的非常长的列表。这是一个原始的例子:
04:50 10 244.685 0 0
05:00 10 244.680 0 0
HBCHa 9990 Seite 762
16.02.16
Hafenpegel
Pegel müM Var 0 Pegelstand
Datum Zeit Intervall müM Q Art
Sonntag, 31. Dezember 2000 05:10 10 244.679 0 0
05:20 10 244.688 0 0
05:30 10 244.694 0 0
05:40 10 244.688 0 0
正如您所看到的,字符串中有一行包含测量数据,以" Sonntag"
开头我的目标是:
04:50 10 244.685 0 0
05:00 10 244.680 0 0
HBCHa 9990 Seite 762
16.02.16
Hafenpegel
Pegel müM Var 0 Pegelstand
Datum Zeit Intervall müM Q Art
Sonntag, 31. Dezember 2000
05:10 10 244.679 0 0 !!
05:20 10 244.688 0 0
05:30 10 244.694 0 0
05:40 10 244.688 0 0
我设法将txt文件写入列表,这里称为" data_list_splitted",在整个txt文件中捕获此onle行,将其拆分并使用度量提取部分:
for i in data_list_splitted:
if len(i) >= 40:
ii = i.split(";")
txt_line = "%s;%s;%s;%s;%s"%(ii[4],ii[5],ii[6],ii[7],ii[8])
但是我没有打破这一行并在运行列表中添加测量值!
我认为这应该是那么困难吗? 有任何想法吗? 非常感谢你!
答案 0 :(得分:0)
您可以创建另一个列表并在其中插入值
NSString *password = [passwordTextField stringValue];
UInt32 passwordlength = (UInt32) [password length];
void *mypassword = malloc(passwordlength);
mypassword = &password;
StorePasswordKeychain(mypassword, passwordlength);