Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: How to invoke a function with return statement in list comprehension?
Post: RE: How to invoke a function with return statement...

(Jul-17-2021, 12:01 PM)Yoriz Wrote: from itertools import takewhile def func(number): return True if number % 2 else False numbers = [2, 2, 3, 4] new_list = [func(number) for number in numbe...
maiya General Coding Help 4 453 Jul-17-2021, 04:30 PM
    Thread: How to invoke a function with return statement in list comprehension?
Post: RE: How to invoke a function with return statement...

I want to store the return value from the function not the list numbers.
maiya General Coding Help 4 453 Jul-17-2021, 11:23 AM
    Thread: How to invoke a function with return statement in list comprehension?
Post: How to invoke a function with return statement in ...

Hi All, I want to invoke a function with return statement using list comprehension or even lambda (if possible) for the better performance. Below is code snippet where I am trying to achieve that in ...
maiya General Coding Help 4 453 Jul-17-2021, 09:35 AM
    Thread: how to catch schema error?
Post: how to catch schema error?

Hi All, I wanted to catch the schema error from yaml schema validation, at the same time it should not throw on console as well. I have written some sample code here, from here I could able to catch ...
maiya General Coding Help 0 269 Jul-16-2021, 08:37 AM
    Thread: how to suppress not to display the package contents from pydoc!
Post: RE: how to suppress not to display the package con...

(Mar-18-2021, 10:19 AM)Larz60+ Wrote: what you are showing is not sample code. It looks more like a document header. Please post your code. Quote:No Sir, actually when I issue pydoc3 -w mymodule whe...
maiya General Coding Help 3 668 Mar-19-2021, 02:33 AM
    Thread: how to suppress not to display the package contents from pydoc!
Post: how to suppress not to display the package content...

Hi All, Below is my sample code, where I do not want to display the PACKAGE CONTENTS section (means I wanted to suppress this, as not to display it) while issuing the command as pydoc3 -w mymodule N...
maiya General Coding Help 3 668 Mar-18-2021, 07:46 AM
    Thread: how to get process handler?
Post: RE: how to get process handler?

Hi All, #!/usr/bin/env python3 import subprocess proc = subprocess.Popen(['ls'], stdin = subprocess.PIPE, stdout = subprocess.PIPE) proc.stdin.write('\n'.encode()) while True: output = proc.s...
maiya General Coding Help 1 423 Feb-23-2021, 07:34 AM
    Thread: how to get process handler?
Post: how to get process handler?

Hi All, I have few questions 1. how to get the process handler? 2. how to keep the process open throughout the entire execution of the script 3. while reading an output from the process, it should no...
maiya General Coding Help 1 423 Feb-23-2021, 06:40 AM
    Thread: How to keep the process alive?
Post: RE: How to keep the process alive?

I need to write/read data to and from subprocess without closing the pipe, will close in end of the execution (process should be available entire duration) Need to fire the command and get the output...
maiya General Coding Help 2 564 Feb-19-2021, 07:30 AM
    Thread: How to keep the process alive?
Post: How to keep the process alive?

Hi All, I wanted to keep the process alive while opening a process using subprocess and keep firing the commands and read its output throughout the execution. which should support both python3 and py...
maiya General Coding Help 2 564 Feb-18-2021, 02:57 PM
    Thread: python tool to collect the time measurement of entire code
Post: python tool to collect the time measurement of ent...

Hi Team, Can any one suggest me that how to get the time measurement for entire lines of code and functions (each function wise)? I am looking for the command line or tools Regards, Maiya
maiya General Coding Help 3 679 Feb-12-2021, 11:25 AM
    Thread: capture pytest results to a file
Post: RE: capture pytest results to a file

Quote: (Oct-16-2020, 02:21 PM)Askic Wrote: (Oct-16-2020, 12:44 PM)maiya Wrote: Hi, my_test.py::test_001_mytest PASSED [ 50%] my_test.py::test_002_myte...
maiya General Coding Help 2 1,034 Oct-17-2020, 03:42 AM
    Thread: capture pytest results to a file
Post: capture pytest results to a file

Hi, my_test.py::test_001_mytest PASSED [ 50%] my_test.py::test_002_mytest PASSED [100%] ==================...
maiya General Coding Help 2 1,034 Oct-16-2020, 12:44 PM
    Thread: how to pass the interactive string to Popen subprocess
Post: how to pass the interactive string to Popen subpro...

Hi All, How to pass the interactive string to Popen subprocess and also it should support both python 2 as well as python3 interpreters. For example - pass the string while opening Popen process, t...
maiya General Coding Help 1 635 Sep-18-2020, 03:28 PM
    Thread: How to rotate log and limit the size
Post: How to rotate log and limit the size

Hi All, Below is my logging function and it is defined in my class. There are multiple functions are defined in my class and also a different file which is being imported as well. Here I need to limi...
maiya General Coding Help 0 703 Aug-29-2020, 12:41 AM
    Thread: How to limit the fie size in logging.
Post: RE: How to limit the fie size in logging.

logging_file = 'test.log' logging_format = '%(asctime)s: [%(levelname)s] [{}] %(message)s'.format(self.action) logging.basicConfig( filename = '{}'.format(logging_file), format = ...
maiya General Coding Help 2 2,002 Jul-29-2020, 06:49 AM
    Thread: how to solve "a bytes-like object is required, not 'str'" error
Post: how to solve "a bytes-like object is required, not...

Hi All, Am getting the following error, while writing a string to process using write method in python 3, and it works very well for python 2. I have googled it and found encode() and decode. When I...
maiya General Coding Help 2 955 Jul-28-2020, 06:14 PM
    Thread: How to limit the fie size in logging.
Post: How to limit the fie size in logging.

Hi All, How to limit the file size and should start to write into a new file in logging. Much appreciated your help/suggestions on this. Thanks a lot. Regards, Maiya
maiya General Coding Help 2 2,002 Jul-28-2020, 06:13 PM
    Thread: how to create my own custom logging message
Post: RE: how to create my own custom logging message

Hi All, any help regarding this, much appreciated. Thanks a lot. Regards, Maiya
maiya General Coding Help 4 993 Jul-15-2020, 05:42 PM
    Thread: import yaml error for python3
Post: RE: import yaml error for python3

Hi Sir, I have created a project using python (2) and wanted to migrate/support to python 3 now. So is there any best and efficient way to find out any code of the my project/product which is not sup...
maiya General Coding Help 4 5,451 Jul-15-2020, 05:38 PM

User Panel Messages

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