0

I want to create a python program for everyone to use and I've got a function where it requires the path that goes to a specific file, and I tried to search on Stack Overflow but I'm not sure how to phrase the question.

This is what I have so far:

path = "C:\\Users\\pwalk\\AppData\\

and what I want to do is get rid of that 'pwalk'.

khelwood
  • 55,782
  • 14
  • 81
  • 108
  • what do you mean "get rid" of it. If 'pwalk' is the name of your user, then you can't remove it. If you want, you can move it to your IDE and then just call the name of the file. – A random coder Dec 03 '20 at 20:50
  • What i want is that i would like something where it doesnt require a username For example: C:\Users\..\AppData – PWalkersCrisps Dec 03 '20 at 20:51
  • You can't do that normally. Like I said, you can move your file to your IDE, then the path would just be the name of the file. – A random coder Dec 03 '20 at 20:52
  • Do you want to use the home dir ? you can use %userprofile% env variable – Avihay Tsayeg Dec 03 '20 at 20:56
  • Note that the dup is for Windows. See also: [Python: Getting AppData folder in a cross-platform way](https://stackoverflow.com/q/19078969) – 001 Dec 03 '20 at 21:00

0 Answers0