當前位置: 首頁>>代碼示例>>Python>>正文


Python Data.data_from_line方法代碼示例

本文整理匯總了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")
開發者ID:LowEnergyMonitoring,項目名稱:Raspberry,代碼行數:15,代碼來源:File2Path.py

示例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")
開發者ID:LowEnergyMonitoring,項目名稱:Raspberry,代碼行數:15,代碼來源:File2Path.py

示例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
開發者ID:LowEnergyMonitoring,項目名稱:Raspberry,代碼行數:7,代碼來源:File2Path.py


注:本文中的Data.data_from_line方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。