Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Adder timer to 1 of these columns Post 303038455 by bigvito19 on Tuesday 3rd of September 2019 12:25:56 PM
Old 09-03-2019
Add timer to 1 of these files in this script

I have 2 files that print on the same line at the same time. I wanted to add time.sleep() to 1 of the textfiles. I wanted to delay the time that 1 textfile prints with the other 1 in this script. I wanted to have the files to create new lines instead of printing the same combinations when they both print. Where to add the time.sleep()?


Code:
from itertools import izip_longest
import time

with open("file1") as textfile1, open("file2") as textfile2:
for x, y in izip_longest(textfile1, textfile2, fillvalue=""):
    x = x.strip()
    y = y.strip()
    print("{0}{1}".format(x, y))


Last edited by bigvito19; 09-04-2019 at 01:20 PM..
 

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

reply timer

Neo, can u please shorten the reply timer to like 1 min or so. It is prolly just me but i end up passing on replying to posts due to i hate waiting for my timer to reset w/ a 2.5 mins wait. (2 Replies)
Discussion started by: Optimus_P
2 Replies

2. AIX

how to implement timer

anyone can help me how to implement the timer on AIX? I tried with 'setitimer' and its related functions, but it does not work correctly,the program exited each time. thanks (2 Replies)
Discussion started by: Frank2004
2 Replies

3. Shell Programming and Scripting

writing a timer

Hi!, My shell script takes a quite a long time to execute.. Nothing appears on the screen during this period.. User are left guessing... whats going on???????????? Any ideas on how to create a small timer script which print a word on screen say " wait.. Program running" after every 10 seconds... (3 Replies)
Discussion started by: jyotipg
3 Replies

4. Shell Programming and Scripting

timer

Hi all, Wanted to a create a shell script ----------------------------------------------------------------------- 1) which when called will start a timer and wait for 48 hours. after 48 hours it will call some function(say XYZ) 2) Whenever this shell script is called (can be called... (3 Replies)
Discussion started by: k_oops9
3 Replies

5. Shell Programming and Scripting

VNC Timer

Hello fellows, I am new in this forum, i would appreciate your assistance. I need a timming system for my vnc desktops (Cybercafe timer stuff). Each unix user login to my server only with vnc, and i want to write a program that can generate timer tickets and have control on the time used for... (0 Replies)
Discussion started by: foweja
0 Replies

6. UNIX for Advanced & Expert Users

Timer for VNC

Hello fellows, I am new in this forum, i would appreciate your assistance. I need a timming system for my vnc desktops (Cybercafe timer stuff). Each unix user login to my server only with vnc, and i want to write a program that can generate timer tickets and have control on the time used for... (1 Reply)
Discussion started by: foweja
1 Replies

7. UNIX for Dummies Questions & Answers

timer interrupt

hello all since a process running in kernel mode cannnot be preempted by any other process what would be the status of Timer interrupt that occurs when the time quantum of a process is elapsed? thanks (2 Replies)
Discussion started by: compbug
2 Replies

8. Shell Programming and Scripting

Timer

Is there a way to make a timer? E.g Please give the seconds... ... (6 Replies)
Discussion started by: aekaramg20
6 Replies

9. UNIX for Dummies Questions & Answers

Timer

is there a timer function in unix without using C? for example i want to display a message after 5 seconds how do i do that? (2 Replies)
Discussion started by: khestoi
2 Replies

10. Shell Programming and Scripting

Timer as output

How do you set timer as output to the command line so that you get an output like Has been waiting for 5 seconds Has been waiting for 6 seconds ... Where only the number changes. (2 Replies)
Discussion started by: locoroco
2 Replies
cmp(1)							      General Commands Manual							    cmp(1)

Name
       cmp - compare two files

Syntax
       cmp [-l | -s] file1 file2  [ skip1 ]  [ skip2 ]

Description
       The  command  compares two files.  If either file1 or file2 is `-', standard input is used for the file.  With no options, makes no comment
       if the files are the same.  If they differ, it reports the byte and line number at which the difference occurred to  standard  output.	If
       one file is an initial subsequence of the other a message including the file name is written to standard error.

       The optional skip1 and skip2 parameters are initial byte offsets into file1 and file2 respectively and may be either octal, by specifying a
       leading 0, or decimal.  When using skip1 and skip2 the offset is treated as the start of the respective input file.  Only one option may be
       specified  at  a  time.	Only one of the input files may be standard input at a time.  Because the line number is not calculated when using
       either of the options the use of either flag will increase the speed of

Options
       -l Long format:	prints the byte number (decimal) and the differing bytes (octal) for each difference.

       -s Suppresses normal output and sets the exit code only.

Diagnostics
       Exit code 0 is returned for identical files, 1 for different files, and 2 for an inaccessible or missing argument.

See Also
       comm(1), diff(1)

																	    cmp(1)
All times are GMT -4. The time now is 07:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy