Python Forum
Combining 2 or more scripts to one.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combining 2 or more scripts to one.
#2
I'm not sure the ins and outs of those modules, but shoot for something like this:


import time
import schedule    
   
def task1():  
    existingLines = set(line.strip() for line in open("C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie .dat"))
    outfile = open("C:\\Users\\Makada\\Desktop\\CR1000_Table1 - kopie .dat", "a+")
    for content in open("C:\\Campbellsci\\LoggerNet\\CR1000_Table1.dat", "r"):
        if content.strip() not in existingLines: # to void duplicate lines
            outfile.write(content)
            existingLines.add(content)
    outfile.close()
   
def task2():  
    existingLines = set(line.strip() for line in open("C:\\Users\\Makada\\Desktop\\CR1000_Table2 - kopie.dat"))
    outfile = open("C:\\Users\\Makada\\Desktop\\CR1000_Table2 - kopie.dat", "a+")
    for content in open("C:\\Campbellsci\\LoggerNet\\CR1000_Table2.dat", "r"):
        if content.strip() not in existingLines: # to void duplicate lines
            outfile.write(content)
            existingLines.add(content)
    outfile.close()

schedule.every().minute.at(":01").do(task1)  
schedule.every().minute.at(":10").do(task2)
while True:
    schedule.run_pending()
    time.sleep(1)
refresh()
Reply


Messages In This Thread
Combining 2 or more scripts to one. - by Makada - Mar-29-2020, 08:47 PM
RE: Combining 2 or more scripts to one. - by michael1789 - Mar-29-2020, 10:39 PM
RE: Combining 2 or more scripts to one. - by Makada - Mar-30-2020, 05:16 AM
RE: Combining 2 or more scripts to one. - by Makada - Mar-30-2020, 08:20 AM
RE: Combining 2 or more scripts to one. - by Makada - Mar-30-2020, 04:28 PM
RE: Combining 2 or more scripts to one. - by Makada - Mar-31-2020, 10:34 AM
RE: Combining 2 or more scripts to one. - by Makada - Apr-01-2020, 05:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  interloper help appreciated combining two python3 scripts to add new conditions. Ricktoddfrank 0 1,521 Jun-22-2021, 10:24 PM
Last Post: Ricktoddfrank

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020