本文整理匯總了Python中Data.data_from_line方法的典型用法代碼示例。如果您正苦於以下問題:Python Data.data_from_line方法的具體用法?Python Data.data_from_line怎麽用?Python Data.data_from_line使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Data
的用法示例。
在下文中一共展示了Data.data_from_line方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: remove7
# 需要導入模塊: import Data [as 別名]
# 或者: from Data import data_from_line [as 別名]
def remove7(path_number):
with open("tmp.txt", 'w') as tmp:
with open("Path#" + str(path_number) + ".txt", "r") as f:
for line in f:
if line.strip():
tmp_d = da.data_from_line(line)
if tmp_d.sonar_id != 7:
tmp.write(line)
with open("tmp.txt", 'r') as tmp:
with open("Path#" + str(path_number) + ".txt", "w") as f:
for line in tmp:
f.write(line)
os.remove("tmp.txt")
示例2: format_file
# 需要導入模塊: import Data [as 別名]
# 或者: from Data import data_from_line [as 別名]
def format_file(path_number):
with open("tmp.txt", 'w') as tmp:
with open("Path#" + str(path_number) + ".txt", "r") as f:
for line in f:
if line.strip():
tmp_d = da.data_from_line(line)
if MIN_MEASURE < tmp_d.measure < MAX_MEASURE:
tmp.write(line)
with open("tmp.txt", 'r') as tmp:
with open("Path#" + str(path_number) + ".txt", "w") as f:
for line in tmp:
f.write(line)
os.remove("tmp.txt")
示例3: extract_from_file
# 需要導入模塊: import Data [as 別名]
# 或者: from Data import data_from_line [as 別名]
def extract_from_file(data, path_number):
with open("Path#" + path_number + ".txt", "r") as f:
for line in f:
data.append(da.data_from_line(line))
return data