Python Forum
Information about api.sunrise-sunset please
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Information about api.sunrise-sunset please
#11
Thanks very much again.

Please allow one more question. Using this current code, What will I have to change so the program knows when day light savings time (DST) is in effect in this area? Is there something in Python that will tell the program that daylight savings time is in effect? Will I have to check for DST then change the value of timezone_hour_offset or is there a slicker way?
Reply
#12
Assuming you're not on Windows, something like this should work:
import requests
from datetime import datetime,timedelta
from zoneinfo import ZoneInfo

latitude = 28.262222
longitude = -96.747165
target_timezone = "America/Chicago"
timezone_offset = ZoneInfo(target_timezone).utcoffset(datetime.now())

url = "https://api.sunrise-sunset.org/json"
params = {
        "lat": latitude,
        "lng": longitude,
        "formatted": 0,
        "date": "today",
        }

input_format   = "%Y-%m-%dT%H:%M:%S+00:00"
output_format  = "%H:%M:%S"

resp_json = requests.get(url, params=params).json()
sunrise_date_time  = resp_json["results"]["sunrise"]

sunrise = datetime.strptime(sunrise_date_time, input_format)
local_sunrise = sunrise + timezone_offset

print(f"sunrise is at {sunrise.strftime(output_format)} UTC")
print(f"sunrise is at {local_sunrise.strftime(output_format)} local")
print(f"Local time is {timezone_offset.total_seconds() / 3600} hours from UTC")
If you are on windows, you'll probably have to first make sure you get the tzdata package.
Reply
#13
(Jan-29-2022, 11:52 PM)bill_z Wrote: Is there something in Python that will tell the program that daylight savings time is in effect? Will I have to check for DST then change the value of timezone_hour_offset or is there a slicker way?
The slicker way is to use Pendulum as mention,it has check for this .is_dst()
If look at bowlofred code then you need to install tzdata package.
So you need to get pip working there is really no way to work with in Python efficiently without.

Example,so now in Norway there is not Daylight Saving Time (DST).
>>> import pendulum
>>>
>>> now = pendulum.now()
>>> now
DateTime(2022, 1, 30, 11, 37, 43, 497808, tzinfo=Timezone('Europe/Berlin'))
>>> now.is_dst()
False
I would guess that in 50-60 days we will change in Norway.
I could just write a test to figure it out.
>>> for day in range(30, 60):
...     if now.add(days=day).is_dst():
...         print(day)
...         break
...     
56
So in Norway there is 56 days until change of DST.
Reply
#14
Please, someone tell me how do I install ether or both zoneinfo or Pendulum.

I'm running python3 on raspbain OS on a Raspberry pi B3+. Everything you all have suggested works except zoneinfo or Pendulum because of the error below.

Error:
pi@raspberrypi:~ $ python3 daylight_sunrise.py Traceback (most recent call last): File "daylight_sunrise.py", line 3, in <module> from zoneinfo import ZoneInfo ModuleNotFoundError: No module named 'zoneinfo' pi@raspberrypi:~ $ pip3 install zoneinfo Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting zoneinfo Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/zoneinfo/ pi@raspberrypi:~ $
Reply
#15
What happens if you run this commands?
python3 -m pip install --upgrade pip
python3 -m pip install pendulum

sudo pip3 install --upgrade setuptools pip
pip3 install pendulum
There is no reason for using a old version as Python 3.7,even if use Raspberry pi.
How To Install the Latest Python Version on Raspberry Pi?
How to Setup Raspberry Pi OS: Bullseye like a Python Pro
I use pyenv for all OS that is not Windows,my tutorial.

When get new version of Python then it also comes with a new version of is pip.
Reply
#16
As you suggested, I tried your commands with no joy.

Here are all of the errors (and there are a bunch). In some cases there are exception errors and other cases, it can't find a file it expects. I ran the commands under sudo and got what looked like the same errors.

Error:
pi@raspberrypi:~ $ python3 -m pip install --upgrade pip Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting pip Downloading https://files.pythonhosted.org/packages/9f/8b/a094f5da22d7abf5098205367b3296dd15b914f4232af5ca39ba6214d08c/pip-22.0-py3-none-any.whl (2.1MB) 100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 2.1MB 126kB/s Installing collected packages: pip Successfully installed pip-22.0 pi@raspberrypi:~ $ python3 -m pip install pendulum Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple ERROR: Exception: Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper status = run_func(*args) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper return func(self, options, args) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 340, in run reqs, check_supported_wheels=not options.target_dir File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve collected.requirements, max_rounds=try_to_avoid_resolution_too_deep File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve state = resolution.resolve(requirements, max_rounds=max_rounds) File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 348, in resolve self._add_to_criteria(self.state.criteria, r, parent=None) File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria if not criterion.candidates: File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__ return bool(self._sequence) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__ return any(self) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr> return (c for c in iterator if id(c) not in self._incompatible_ids) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 44, in _iter_built for version, func in infos: File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 297, in iter_index_candidate_infos hashes=hashes, File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 868, in find_best_candidate candidates = self.find_all_candidates(project_name) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 809, in find_all_candidates page_candidates = list(page_candidates_it) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/sources.py", line 134, in page_candidates yield from self._candidates_from_page(self._link) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 773, in process_project_url page_links = list(parse_links(html_page, self._use_deprecated_html5lib)) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 310, in wrapper_wrapper return list(fn(page, use_deprecated_html5lib)) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 350, in parse_links parser.feed(page.content.decode(encoding)) File "/usr/lib/python3.7/html/parser.py", line 111, in feed self.goahead(0) File "/usr/lib/python3.7/html/parser.py", line 179, in goahead k = self.parse_html_declaration(i) File "/usr/lib/python3.7/html/parser.py", line 270, in parse_html_declaration self.handle_decl(rawdata[i+2:gtpos]) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 405, in handle_decl self._raise_error() File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 427, in _raise_error "HTML doctype missing or incorrect. Expected <!DOCTYPE html>.\n\n" ValueError: HTML doctype missing or incorrect. Expected <!DOCTYPE html>. If you believe this error to be incorrect, try passing the command line option --use-deprecated=html5lib and please leave a comment on the pip issue at https://github.com/pypa/pip/issues/10825. pi@raspberrypi:~ $ sudo pip3 install --upgrade setuptools pip Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting setuptools Downloading https://files.pythonhosted.org/packages/eb/53/0dd4c7960579da8be13fa9b2c2591643d37f323e3d79f8bc8b1b6c8e6217/setuptools-60.5.0-py3-none-any.whl (958kB) 100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 962kB 268kB/s Collecting pip Downloading https://files.pythonhosted.org/packages/9f/8b/a094f5da22d7abf5098205367b3296dd15b914f4232af5ca39ba6214d08c/pip-22.0-py3-none-any.whl (2.1MB) 100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 2.1MB 123kB/s Installing collected packages: setuptools, pip Found existing installation: setuptools 40.8.0 Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'setuptools'. No files were found to uninstall. Found existing installation: pip 18.1 Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'pip'. No files were found to uninstall. Successfully installed pip-22.0 setuptools-60.5.0 pi@raspberrypi:~ $ pip3 install pendulum WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple ERROR: Exception: Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper status = run_func(*args) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper return func(self, options, args) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 340, in run reqs, check_supported_wheels=not options.target_dir File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve collected.requirements, max_rounds=try_to_avoid_resolution_too_deep File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve state = resolution.resolve(requirements, max_rounds=max_rounds) File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 348, in resolve self._add_to_criteria(self.state.criteria, r, parent=None) File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria if not criterion.candidates: File "/home/pi/.local/lib/python3.7/site-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__ return bool(self._sequence) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__ return any(self) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr> return (c for c in iterator if id(c) not in self._incompatible_ids) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 44, in _iter_built for version, func in infos: File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 297, in iter_index_candidate_infos hashes=hashes, File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 868, in find_best_candidate candidates = self.find_all_candidates(project_name) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 809, in find_all_candidates page_candidates = list(page_candidates_it) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/sources.py", line 134, in page_candidates yield from self._candidates_from_page(self._link) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 773, in process_project_url page_links = list(parse_links(html_page, self._use_deprecated_html5lib)) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 310, in wrapper_wrapper return list(fn(page, use_deprecated_html5lib)) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 350, in parse_links parser.feed(page.content.decode(encoding)) File "/usr/lib/python3.7/html/parser.py", line 111, in feed self.goahead(0) File "/usr/lib/python3.7/html/parser.py", line 179, in goahead k = self.parse_html_declaration(i) File "/usr/lib/python3.7/html/parser.py", line 270, in parse_html_declaration self.handle_decl(rawdata[i+2:gtpos]) File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 405, in handle_decl self._raise_error() File "/home/pi/.local/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 427, in _raise_error "HTML doctype missing or incorrect. Expected <!DOCTYPE html>.\n\n" ValueError: HTML doctype missing or incorrect. Expected <!DOCTYPE html>. If you believe this error to be incorrect, try passing the command line option --use-deprecated=html5lib and please leave a comment on the pip issue at https://github.com/pypa/pip/issues/10825. pi@raspberrypi:~ $ pi@raspberrypi:~ $ sudo python3 -m pip install --upgrade pip Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: pip in /usr/local/lib/python3.7/dist-packages (22.0) ERROR: Exception: Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper status = run_func(*args) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/req_command.py", line 205, in wrapper return func(self, options, args) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/install.py", line 340, in run reqs, check_supported_wheels=not options.target_dir File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve collected.requirements, max_rounds=try_to_avoid_resolution_too_deep File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve state = resolution.resolve(requirements, max_rounds=max_rounds) File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 348, in resolve self._add_to_criteria(self.state.criteria, r, parent=None) File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria if not criterion.candidates: File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__ return bool(self._sequence) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__ return any(self) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr> return (c for c in iterator if id(c) not in self._incompatible_ids) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 90, in _iter_built_with_inserted for version, func in infos: File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 297, in iter_index_candidate_infos hashes=hashes, File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/package_finder.py", line 868, in find_best_candidate candidates = self.find_all_candidates(project_name) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/package_finder.py", line 809, in find_all_candidates page_candidates = list(page_candidates_it) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/sources.py", line 134, in page_candidates yield from self._candidates_from_page(self._link) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/package_finder.py", line 773, in process_project_url page_links = list(parse_links(html_page, self._use_deprecated_html5lib)) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/collector.py", line 310, in wrapper_wrapper return list(fn(page, use_deprecated_html5lib)) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/collector.py", line 350, in parse_links parser.feed(page.content.decode(encoding)) File "/usr/lib/python3.7/html/parser.py", line 111, in feed self.goahead(0) File "/usr/lib/python3.7/html/parser.py", line 179, in goahead k = self.parse_html_declaration(i) File "/usr/lib/python3.7/html/parser.py", line 270, in parse_html_declaration self.handle_decl(rawdata[i+2:gtpos]) File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/collector.py", line 405, in handle_decl self._raise_error() File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/collector.py", line 427, in _raise_error "HTML doctype missing or incorrect. Expected <!DOCTYPE html>.\n\n" ValueError: HTML doctype missing or incorrect. Expected <!DOCTYPE html>. If you believe this error to be incorrect, try passing the command line option --use-deprecated=html5lib and please leave a comment on the pip issue at https://github.com/pypa/pip/issues/10825. pi@raspberrypi:~ $
Reply
#17
Something is wrong,follow the link and try to install new Python version.
Reply
#18
(Jan-30-2022, 10:47 AM)snippsat Wrote: If look at bowlofred code then you need to install tzdata package.

Only on Windows. MacOS/Linux systems should already have a tzdatabase that zoneinfo can use.

(Jan-30-2022, 12:54 PM)bill_z Wrote: Please, someone tell me how do I install ether or both zoneinfo or Pendulum.
zoneinfo is part of python, but only python 3.9 or later.

Looks like standard rpi releases lag on the version of python. Here's a thread for updating the python version on rpi. https://forums.raspberrypi.com/viewtopic...9#p1761359
Reply
#19
Maybe all of this should be a different thread, but, it seems, getting the correct routines, requires getting the correct version of Python. The latest Raspbain OS has Python2.7 & Python3.7.

The sudo apt update & sudo apt upgrade didn't upgrade python3, so I searched for a 'how to' on moving from 3.7 to 3.10. All I found was 'Install the Latest Python Version on Raspberry Pi'. This article didn't have a publishing date and it looked like, at the time of publishing 3.9 was the latest. So I gave it a try unsuccessfully. All of the commands did execute successfully, but, when I checked the version at the end, it was still 3.7.

I was using Raspbain GUI & terminal mode to do the download and follow the instructions. Not using Windows, IOS or anything else. I started in the default login directory /home/pi

Would someone help me by telling what I didn't do that caused this to NOT work, or maybe give me the correct procedures?

The URL where I got this list of commands is here:

https://raspberrytips.com/install-latest...pberry-pi/

Here is my history of commands:
Output:
1236 python --version 1237 python3 --version 1238 wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz 1239 tar -zxvf Python-3.10.2.tgz 1240 cd Python-3.10.2 1241 ./configure --enable-optimizations 1242 sudo make altinstall 1243 ls /usr/bin/python -latr 1244 ls /usr/bin/python3 -latr 1245 ls /usr/bin/python3.10 -latr 1246 cd /usr/bin 1247 sudo rm python 1248 sudo ln -s /usr/local/bin/python3.10.2 python 1249 python --version 1250 ls /usr/bin/python3.10 -latr 1251 ls /usr/bin/python3.10.2 -latr 1252 python3.10.2 --version
Reply
#20
(Jan-31-2022, 01:29 PM)bill_z Wrote: Here is my history of commands:
What's the output when running these commands?,that's what show you if the install is working.

I can quickly install Python 3.10.2 and show how output should look when it's working.
tom@tom-VirtualBox:~$ pyenv install 3.10.2
Downloading Python-3.10.2.tar.xz...
-> https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tar.xz
Installing Python-3.10.2...
Installed Python-3.10.2 to /home/tom/.pyenv/versions/3.10.2

tom@tom-VirtualBox:~$ pyenv global 3.10.2
So now testing installation.
tom@tom-VirtualBox:~$ python --version
Python 3.10.2
tom@tom-VirtualBox:~$ pip --version
pip 21.2.4 from /home/tom/.pyenv/versions/3.10.2/lib/python3.10/site-packages/pip (python 3.10) 
See that both output python 3.10.
Try with both python3 --version or pip3 --version if have trouble.
Or.
python -m pip --version 
python3 -m pip --version 
Install test.
tom@tom-VirtualBox:~$ pip install pendulum
Collecting pendulum
  Downloading pendulum-2.1.2.tar.gz (81 kB)
     |████████████████████████████████| 81 kB 1.1 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting pytzdata>=2020.1
  Downloading pytzdata-2020.1-py2.py3-none-any.whl (489 kB)
     |████████████████████████████████| 489 kB 4.4 MB/s 
Collecting python-dateutil<3.0,>=2.6
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: pendulum
  Building wheel for pendulum (PEP 517) ... done
  Created wheel for pendulum: filename=pendulum-2.1.2-cp310-cp310-manylinux_2_27_x86_64.whl size=165287 sha256=2617e9a30e5e5f54e3a6359eb63814e64c4d2938a70d89dbdef32c5daadad3de
  Stored in directory: /home/tom/.cache/pip/wheels/2e/41/ed/f113e4c9dc10f6c846d69f412e9cd9aa429960a3e2e485a4f9
Successfully built pendulum
Installing collected packages: six, pytzdata, python-dateutil, pendulum
Successfully installed pendulum-2.1.2 python-dateutil-2.8.2 pytzdata-2020.1 six-1.16.0

# Test that it work.
tom@tom-VirtualBox:~$ python 
Python 3.10.2 (main, Jan 31 2022, 15:25:53) [GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pendulum
>>> 
>>> pendulum.__version__
'2.1.2'
>>> exit()
Now that have Python 3.10.2 working can run code like this that has the new switch/case statements or as it's called Structural Pattern Matching.
vehicle = 'Taxi'
match vehicle:
    case 'Car':
        print('Drive yourself')
    case 'Bus'|'Taxi':
        print('Public transport')
    case _:
        print(f'{vehicle!r} not in record'
Output:
Public transport
Reply


Forum Jump:

User Panel Messages

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