street.swee...@mailworks.org writes: > I get an error if I try > > from datetime.datetime import now, strftime
‘datetime.datetime’ is not a module, so you can not import objects from it. > But if I import all of os and datetime, I can use those functions by > writing the full 'path' 3 levels deep: > > os.path.expanduser('~') > datetime.datetime.now() Yes. That's a good way to do it, because it makes your code explicit and clear to read. > Is there a way to import individual functions from datetime.datetime? Don't try to do that. Namespaces are a honking good idea in Python, you should not seek to avoid them. -- \ “I may disagree with what you say, but I will defend to the | `\ death your right to mis-attribute this quote to Voltaire.” | _o__) —Avram Grumer, rec.arts.sf.written, 2000-05-30 | Ben Finney _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor