Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python 3 from command line
#2
Remember this Thread Dixon? and use code tag.
So there did i post full working setup,that takes it also one step further as also making a wheel.
The vvsearch module will also of course working stand alone,it's from the book you did read Head first Python.
I did a called it vvsearch,so you should avoid conflict if already make vsearch.
# vvsearch.py
def search4vowels(phrase: str) -> set:
    vowels = set('aeiou')
    return vowels.intersection(set(phrase))

def search4letters(phrase: str, letters: str) -> set:
    return set(letters).intersection(set(phrase))

if __name__ == '__main__':
    print(search4letters('hitch-hiker', 'aeiou'))
    print(search4letters('galaxy', 'xyz'))
    print(search4letters('life, the universe, and everything', 'o'))
Usage if import:
C:\code
λ ptpython
>>> import vvsearch

>>> vvsearch.search4vowels('abcde')
{'e', 'a'}
>>> vvsearch.search4letters('hello', 'aeiou')
{'e', 'o'}
Reply


Messages In This Thread
python 3 from command line - by Dixon - Mar-01-2020, 05:27 PM
RE: python 3 from command line - by snippsat - Mar-01-2020, 08:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Command line argument issue space issue mg24 5 1,361 Oct-26-2022, 11:05 PM
Last Post: Yoriz
  accept command line argument mg24 5 1,365 Sep-27-2022, 05:58 PM
Last Post: snippsat
  multi-line CMD in one-line python kucingkembar 5 4,067 Jan-01-2022, 12:45 PM
Last Post: kucingkembar
  Accessing varying command line arguements Rakshan 3 2,079 Jul-28-2021, 03:18 PM
Last Post: snippsat
  How to input & output parameters from command line argument shantanu97 1 2,603 Apr-13-2021, 02:12 PM
Last Post: Larz60+
  Passing List of Objects in Command Line Python usman 7 3,224 Sep-27-2020, 03:45 PM
Last Post: ndc85430
  Taking Multiple Command Line Argument Input bwdu 6 4,085 Mar-29-2020, 05:52 PM
Last Post: buran
  Running linux command line apps... dbrdh 0 1,677 Jan-30-2020, 01:14 PM
Last Post: dbrdh
  Python convert multi line into single line formatted string karthidec 2 9,508 Dec-23-2019, 12:46 PM
Last Post: karthidec
  command line input (arg parse) and data exchange Simba 7 4,356 Dec-06-2019, 11:58 PM
Last Post: Simba

Forum Jump:

User Panel Messages

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