Python Forum
Importing all modules and using it
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing all modules and using it
#1
from os import path

path.exists("foo.txt")

Above code works fine. But lets say I want to import all modules in OS by
from os import *

how can i use path.exists here to verify file exists?
Reply
#2
import os
os.path.exists("foo.txt")
Reply
#3
Importing star (asterisk, everything) is a Python Worst Practice.
So don't do that.
If run eg Pylint,100 Warnings.
[Image: Lu7DEu.jpg]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  confusion on importing modules carter187 4 425 Mar-03-2024, 08:11 PM
Last Post: snippsat
  Importing modules from different folders Tomli 3 1,476 Jun-26-2022, 10:44 AM
Last Post: snippsat
  Importing modules issue mp3909 9 3,565 Jun-24-2020, 10:07 PM
Last Post: snippsat
  Importing Custom Modules in Python 3 Flexico 1 2,600 Aug-24-2019, 08:11 PM
Last Post: snippsat
  Trouble importing modules on a new python version snackman_barry 2 2,578 Jul-12-2019, 11:15 AM
Last Post: snackman_barry
  importing modules PiaNa 1 1,972 Jun-24-2019, 12:50 PM
Last Post: ichabod801
  Importing modules SBachar 2 3,063 Apr-06-2018, 09:08 PM
Last Post: snippsat
  Importing modules Pistolpete 2 2,717 Nov-29-2017, 05:24 PM
Last Post: nilamo
  Modules issue, pip3 download modules only to pyhton3.5.2 not the latest 3.6.1 bmohanraj91 6 8,467 May-25-2017, 08:15 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