dir.by  
Поиск >>

Компьютер, программы
→
Python
 Как в Python проверить есть ли атрибут у объекта ? 
посмотрели 3915 раз
обновлено: 7 February 2021
  Python  
if hasattr(book1, 'author'):
    print(book1.author)
 
← Previous topic
Creating a new application with Python in Visual Studio Code. Debugging the application. See how Python is executed step by step in debugging
 
Next topic →
Python example: "Open the XML file and read the sections and save it to the txt file"
 
Your feedback ... Comments ...
   
Your Name
Your comment (www links can only be added by a logged-in user)

 
• Download and install Python for Windows
New app
Option 1. Create a new application in a text editor and run it on the command line
• Create a new Python application in a text editor and run it on the command line
Option 2 (the best for me). Creating a New App in Visual Studio Code
• Creating a new application with Python in Visual Studio Code. Debugging the application. See how Python is executed step by step in debugging
Python syntax, functions, classes
• How do you check in Python if an object has an attribute?
Examples
• Python example: "Open the XML file and read the sections and save it to the txt file"
• Python example: "Download tasks from Redmine"
• Python example: "HTTP server"
Sites to learn Python
• Sites to learn Python

  Ваши вопросы присылайте по почте: info@dir.by