Skip to content

Tag: directory

Creating directories with OS module

Hi there I’m trying to create a small tool that will create child directory’s within the Root directory Root Dir(python) And child Dir(DS, WEB, Flask, Learn) stuff like that At starting I have done it statically Here is the Code Then I decided to do it dynamically By using two lists just like befo…

How do I run another file in python?

So I know how to write in a file or read a file but how do I RUN another file? for example in a file I have this: a = 1 print(a) How do I run this using another file? Answer using subprocess standard lib or using os standard lib or extract python code from the file and run it

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…

How to rename a virtualenv in Python?

I misspelled the name of the virtualenv while initializing it using: I actually intended to create the environment with the name venv. Having tried to rename the vnev folder to venv, I find that this doesn’t provide much help. The name of the activate environment still renames the old vnev. I would like…

Second newest file

I need the second newest file. In this thread the newest is found: Python get most recent file in a directory with certain extension which uses this construct: However, how can I get not the min or max but the second element? Answer I think this can be a suitable solution: So basically glob.iglob(‘*.log…