Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: How to sort os.walk list?
Post: RE: How to sort os.walk list?

(Oct-09-2020, 03:27 PM)bowlofred Wrote: If you want to visit the directories in order as well, you can also sort, but you have to sort the existing list, not return a new one. Adding dirs.sort()aft...
Denial General Coding Help 6 11,575 Oct-10-2020, 05:28 AM
    Thread: How to sort os.walk list?
Post: RE: How to sort os.walk list?

(Oct-09-2020, 10:34 AM)ibreeden Wrote: for filename in sorted(files): Damn!!! This is so good and easy. **dance** Thanks
Denial General Coding Help 6 11,575 Oct-09-2020, 10:38 AM
    Thread: How to sort os.walk list?
Post: RE: How to sort os.walk list?

(Oct-09-2020, 07:39 AM)DPaul Wrote: What is the logic behind your sorting order ? Individual files first, then the first subdir only...? Paul Sort of. In one sentence I can say - 'Sort files in thei...
Denial General Coding Help 6 11,575 Oct-09-2020, 10:16 AM
    Thread: How to sort os.walk list?
Post: How to sort os.walk list?

Hello All How to sort contents of the list I gathered from os.walk() method? Here is my code: #!/usr/bin/env python3 ...
Denial General Coding Help 6 11,575 Oct-09-2020, 06:52 AM
    Thread: How to remove dict from a list?
Post: RE: How to remove dict from a list?

(Sep-28-2020, 07:09 AM)buran Wrote: use list comprehension. old_list = [rec for rec in old_list if rec.get('format') != 'HEVC']Is this the correct way?
Denial General Coding Help 7 2,955 Sep-28-2020, 08:04 AM
    Thread: How to remove dict from a list?
Post: How to remove dict from a list?

Hello all I have created this list with dictionary for all video files with their media details. I want to remove all dictonaries records from the list where 'format' is not 'HEVC'. #!/usr/bin/env p...
Denial General Coding Help 7 2,955 Sep-28-2020, 07:05 AM
    Thread: argparse --help in one line.
Post: argparse --help in one line.

Hello Following is the part of my code: help_msg = 'Encode video file(s) recursively to HEVC 10Bit.' parser = argparse.ArgumentParser(description=help_msg) ...
Denial General Coding Help 1 2,001 Sep-20-2020, 02:28 PM
    Thread: Put all files in a directory into list. How?
Post: Put all files in a directory into list. How?

Hello I want to put all files recursively in a directory into a list with only certain type of extensions. Here is what I did. #!/usr/bin/env python3 ...
Denial General Coding Help 2 2,141 Sep-18-2020, 02:43 PM
    Thread: print either int or float - How?
Post: print either int or float - How?

Hello I want to print number as whole if there is no decimal point and if there is decimal point, then print with decimal point. For example, length = float(input("Enter length: ")) width = float(i...
Denial General Coding Help 1 1,387 Sep-07-2020, 02:51 PM
    Thread: Shared reference of variables...
Post: Shared reference of variables...

What I understand is Python uses shared reference for variables. I verified by assigning two variables with value of 10 (int). They both had the same memory address. >>> a = 10 >>&g...
Denial General Coding Help 1 1,423 Aug-29-2020, 01:37 PM

User Panel Messages

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