Python Forum
How do you check if something exists or doesn't in the conditions of an if?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you check if something exists or doesn't in the conditions of an if?
#1
Title says it all. How? I would look it up in the Python Docs, but I got the HTML version, not the .pdf version, and I can't figure out how to search.
Reply
#2
You could use the online docs at Python Documents.

Not sure what you mean by "something" you mean like a file? The result of an 'if' statement will result in it being either True or False, depending on how you present the comparison. You might want to give an example of what you are trying to do.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Check if a file exists. Pedroski55 5 3,251 Sep-08-2020, 10:01 AM
Last Post: Pedroski55
  p]Why os.path.exists("abc/d") and os.path.exists("abc/D") treat same rajeev1729 1 2,140 May-27-2020, 08:34 AM
Last Post: DeaD_EyE
  How does while-If-elif-else-If loop conditions check run mrhopeedu 2 1,751 Oct-27-2019, 04:56 AM
Last Post: mrhopeedu
  Check table exists in Database ARV 0 1,911 Oct-03-2019, 02:37 PM
Last Post: ARV
  How to check if class instance exists in a list of class instance objects? sonicblind 23 20,083 May-27-2018, 05:44 AM
Last Post: buran
  3 conditions to check and return ilcaa72 3 3,157 May-24-2018, 03:13 AM
Last Post: ilcaa72
  How to Check if something inside a Database exists? 3.6.0 Rapier 2 4,810 Dec-17-2017, 11:15 PM
Last Post: Larz60+
  os.path.exists apparently doesn't always work! Larz60+ 2 4,825 Oct-10-2017, 10:16 PM
Last Post: sparkz_alot
  check if file exists. ian 6 8,334 Jul-15-2017, 09:34 AM
Last Post: wavic

Forum Jump:

User Panel Messages

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