Skip to content
Advertisement

Tag: path

Python f string with folders

I’m trying to use regex to find a specific file name in a folder, however it seems like my regex is not working. Inside my folder the names of the excel files are Answer You are not testing your regex against anything. pattern.fullmatch will return a method object. You probably wanted to write That being said, I don’t see a

python Pathlib, how do I remove leading directories to get relative paths?

Let’s say I have this directory structure. I want to isolate path components relative to root1/root2, i.e. strip out the leading root part, giving relative directories: The root depth can be arbitrary and the files, the node of this tree, can also reside at different levels. This code does it, but I am looking for Pathlib’s pythonic way to do

Issue with folder path in tkinter (python)

I am having an issue of finding the bug in my code in relation to the folder path using filedialog. I have the following code The following error shows up: Answer To use you have to first create global doesn’t create variable but it is only used in function to inform this function to use external/global variable when you use

Fixing PATH for Python libraries using Bash

I am attempting to install some Python libraries by executing variations of the following command in Bash: I installed Python3 using Homebrew. I then get variations of the following message each time: WARNING: The scripts f2py, f2py3 and f2py3.7 are installed in ‘/Users/x/Library/Python/3.7/bin’ which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress

Why would I add python to PATH

I am beginning to look at python, so when I found a tutorial it said that the first thing to do would be to download python from www.python.org/downloads/ Now when I downloaded python 3, I then started the installation and got to Why would I want to “Add Python 3.5 to PATH”? What is PATH? Why is it not ticked

Python imports relative path

I’ve got a project where I would like to use some python classes located in other directories. Example structure: The absolute path varies, because this project is run on different machines. When my python file with MySampleClass located in /mydir is executed, how do I import OtherClassRoot located in /dir or OtherClassA located in /subdirA? I tried things like: or

Advertisement