I am not sure how you are going to shorten any prompts and also if this is what you are after:-
It looks like you are using pyhton2.6.x or higher...
OSX 10.7.5, default bash terminal using default python version.
Ignore the paretheses in the "print" STATEMENTS, believe it or not this works right back to python Version 1.4.0...
EDIT:
I misinterpreted your post...
You could try intercepting SIGINT, Ctrl-C, and exit that way...
Last edited by wisecracker; 04-03-2016 at 06:28 PM..
Reason: See above...
This User Gave Thanks to wisecracker For This Post:
The sys module not needed for 2.6 above is a new learning for me.
I am already having a KeyboardInterrupt check in my code.
What I am trying to achieve here is to reduce my repeated lines of code and at same time I don't want to loose the functionality of quitting the program on the input "q".
That is , I don't want user to input everything and then check for q value to exit.
I haven't done python since 2013 but here goes...
Results on OSX 10.7.5, default bash terminal running python 2.7.x.
EDIT:
Added "Q" and "" for fullness...
Last edited by wisecracker; 04-04-2016 at 02:34 PM..
Reason: See above.
This User Gave Thanks to wisecracker For This Post:
In the awk below I am trying to add a | that will adjust $2 in the ouput by adding +1 if the original value from file that was used in $3 had a - in it. Line 3 of file is an example of this. In my current awk I just subtract one but I am not sure how to only apply this to those values without a -.... (5 Replies)
Hello everyone,
I have just started python, and there is something that escapes me. I don't understand why my little script doesn't work.
When I do, it work:
my_string = "bonjour"
if len(my_string) < "6":
print(my_string + " < 6")
else:
print(my_string + " > 6")
... (2 Replies)
Hi, I'm new to python, and I work on a little program fpr my rapsberry pi.
This scenario here is a little Midi sysex app for my Roland D-50 Synthesizer.
With an usb attached number keypad I can type numbers from 0 to 9 and the referenced Midi sysex file would be send out to my Roland D-50... (1 Reply)
I have a file full of coordinates of the form:
37.68899917602539 58.07500076293945 57.79100036621094
The numbers don't always have the same number of decimal points. I need to reduce the decimal points of all the numbers (there are 128 rows of 3 numbers) to 2.
I have tried to do this... (2 Replies)
Hello,
I have File1 in a directory A, a File2 in a directory B.
If the File2 is not empty
Then I have to move File1 from directory A to a directory archive
Else no action.
Is it possible to do this from one command line?
Thank you in advance for your answers.
Madi (2 Replies)
Sorry Guys for not being able to explain in one of my earlier post.
I am now putting my requirement with the input file and desired output file.
In the below input file -
Transaction code is at position 31:40.
Business code is from position 318:321
TSCM00000005837 ... (7 Replies)
Hi,
I am new to unix shell programming.
I want to write a shell script for a functionality existing in mainframe system.
I have one file as below as input
123456
&__987
&12yuq
abcdef
_ referes to blank
condition:whenever the input file is having &__ ,it should be replaced... (4 Replies)
I need only those records which has $2 equal to "DEF" independent of case (i.e upper or lower)
nawk -F"," '$2 ~ //{print $0}' file
This returns 3rd record also which i dont want
I tried this but this doesnt work as expected.
nawk -F"," '$2 == ""{print $0}' file
i dont... (3 Replies)