Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Print data in rows and columns
Post: RE: Print data in rows and columns
(Nov-09-2018, 11:27 AM)Larz60+ Wrote: you can use f-string (python 3.6 or newer) or format
using f-string: print(f'{item1:width} {item2:width}')using format:
print('{:10} {:10}'.format(item1, item2)... |
|
rlinux57 |
General Coding Help |
5 |
4,411 |
Nov-10-2018, 05:50 AM |
|
|
Thread: Print data in rows and columns
Post: RE: Print data in rows and columns
Below is my code, Logs file contains hundred thousands of values few of mentioned in previous post. As i have tried your method but unable to fetch it.
fobj = open("logs", "r")
text = fobj.read()
d... |
|
rlinux57 |
General Coding Help |
5 |
4,411 |
Nov-09-2018, 12:40 PM |
|
|
Thread: Print data in rows and columns
Post: Print data in rows and columns
I have make a script in python having below output.
Output:
Output:('User ID' 'Hits', {'1982641': 10, '105350': 9, '1008313': 7, '2073270': 11, '2073279':10})I want to sort by hits and display in row... |
|
rlinux57 |
General Coding Help |
5 |
4,411 |
Nov-09-2018, 06:22 AM |
|
|
Thread: Extract Specific Pattern
Post: RE: Extract Specific Pattern
Hi Volcano63,
Thank you for your answer, I used: ^\d[0-9]+(?:\.[0-9]+){3},(\w+)
Regards,
rlinux57 |
|
rlinux57 |
General Coding Help |
4 |
3,355 |
Sep-25-2018, 04:09 PM |
|
|
Thread: Extract Specific Pattern
Post: RE: Extract Specific Pattern
Hi,
I have edited and print the "Users Connected" to dispel your confusion. I just want to get names through regex. But i am bit weak in regex to extract desired output. When i used python dictionary... |
|
rlinux57 |
General Coding Help |
4 |
3,355 |
Sep-25-2018, 05:12 AM |
|
|
Thread: Extract Specific Pattern
Post: Extract Specific Pattern
Hi Team,
How do I extract specific pattern in below code. As I have tried to get expected output through regex and use Python Dictionary in order to fetch it through values but unable to get it.
#!... |
|
rlinux57 |
General Coding Help |
4 |
3,355 |
Sep-24-2018, 12:20 PM |
|
|
Thread: Use a block of code only one time
Post: RE: Use a block of code only one time
Hi gontajones,
Thank you for helping me.
Regards,
rlinux57 |
|
rlinux57 |
General Coding Help |
14 |
6,246 |
Sep-21-2018, 12:53 PM |
|
|
Thread: Use a block of code only one time
Post: RE: Use a block of code only one time
Hi gontajones,
Now it's working. Could you please explain the condition possible_opts.index(input_value)] . I didn't understand the index.
Regards,
rlinux57 |
|
rlinux57 |
General Coding Help |
14 |
6,246 |
Sep-20-2018, 06:37 PM |
|
|
Thread: Use a block of code only one time
Post: RE: Use a block of code only one time
Hi again,
Lets suppose tuple variable stores values, It could be store more values:
tuple = (786 , 200)
When the argument value is equal to desert then it checks warning, critical and ok level then... |
|
rlinux57 |
General Coding Help |
14 |
6,246 |
Sep-20-2018, 08:41 AM |
|
|
Thread: Use a block of code only one time
Post: RE: Use a block of code only one time
Hi,
Below is the code, Please look into it.
if __name__ == "__main__":
try:
opts, args = getopt.getopt(sys.argv[1:],"i:w:c:")
except getopt.GetoptError:
print("Usage: v2.... |
|
rlinux57 |
General Coding Help |
14 |
6,246 |
Sep-19-2018, 06:02 AM |
|
|
Thread: Use a block of code only one time
Post: RE: Use a block of code only one time
Hi again,
The output of argument desert is fine, But when i mentioned ocean it shows the output of desert again.
Output:#python3.6 script.py -i desert -w 10 -c 20
CRITICAL - Active: 205
#python3.6 ... |
|
rlinux57 |
General Coding Help |
14 |
6,246 |
Sep-18-2018, 07:22 PM |
|
|
Thread: Use a block of code only one time
Post: RE: Use a block of code only one time
Hi again,
Got below error, How do i define idx ?
Error:"message": "E0602:Undefined variable 'idx'"Now code looks:
for opt, arg in opts:
if opt == '-i':
input_value = arg
elif opt == '... |
|
rlinux57 |
General Coding Help |
14 |
6,246 |
Sep-18-2018, 05:38 PM |
|
|
Thread: Use a block of code only one time
Post: Use a block of code only one time
Hi All,
I have a below piece of code, Is it possible to use the green color code single time for different variables ?
Right now this code run as:
#python3.6 testing.py -i desert -w 380 -c 400
OK - A... |
|
rlinux57 |
General Coding Help |
14 |
6,246 |
Sep-18-2018, 10:45 AM |