Python Forum
Calling a Returned Value to Another Function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling a Returned Value to Another Function
#6
Buran already posted first two functions. And last one could be:

import os

def get_file_count(dir_path):
    count = 0
    for name in os.listdir(dir_path):
        if os.path.isfile(os.path.join(dir_path, name)):
            count += 1
    return count
Its possible to do it like one-liner with comprehension, but that would be little confusing.
Reply


Messages In This Thread
RE: Calling a Returned Value to Another Function - by zivoni - Mar-10-2017, 04:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sorting Data Returned From Database Timbo03 9 2,380 Feb-19-2023, 02:12 PM
Last Post: Larz60+
  Calling a function from another function johneven 2 2,997 Jul-09-2019, 12:42 AM
Last Post: micseydel
  Calling function-- how to call simply return value, not whole process juliabrushett 2 3,318 Jul-01-2018, 01:17 AM
Last Post: juliabrushett
  Calling a function to return a list of percentages Liquid_Ocelot 7 6,530 Mar-25-2017, 01:20 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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