Python Forum
'import Path' do not understand how to use it
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'import Path' do not understand how to use it
#1
Greetings!
You guys pointed me to this module - 'import Path' and I'm trying to understand how to use it.
Seached Google, found now simple examples, all the same jibberish about 'home" directory and 'Path.cwd()'
I'm sure there are a lot of people looking for a simple explanation on how to use it.
For example:
from pathlib import Path
home = Path.home()
wave_absolute = Path(home, "ocean", "wave.txt")
print(f" Home Dir ------------- {home}" )
print(f" Absolute path\\file -- {wave_absolute}")
What if a directory is not 'home' but 'c:\\02'
I tried to make changes to the snipped but it errors out.
src = 'c:\\02'
home = Path.src()
Or
home = Path('c:\\02')
I'm sure the module is a great tool but documents are horrible and examples are awful...
Thank you in advance!
Reply


Messages In This Thread
'import Path' do not understand how to use it - by tester_V - Jun-18-2021, 08:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Import a module one step back of the path prathampatel9 1 1,092 Sep-21-2022, 01:34 PM
Last Post: snippsat
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,239 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  import path SpongeB0B 5 2,744 Apr-01-2020, 06:29 AM
Last Post: SpongeB0B
  ImportError: cannot import name 'path' user123 2 12,498 Jul-14-2019, 10:08 AM
Last Post: Larz60+
  .pth file does not show up in sys.path when configuring path. arjunsingh2908 2 5,801 Jul-03-2018, 11:16 AM
Last Post: arjunsingh2908
  Trying to understand how import works in python patrick99e99 3 3,896 Jun-12-2018, 04:48 AM
Last Post: patrick99e99

Forum Jump:

User Panel Messages

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