I am new to python and have been trying to figure this out in a few hours. I want to change the working directory using os in my script using
os.chdir("~") # not working. os.getcwd #--> "/home/pi/Documents" #I want to change into a subfolder I tried following "subfolder" "subfolder/" "~../subfolder" "/subfolder"
I tried
sys.path.append.
if you are in the / home / pi / Dokuments directory and you want to go to / home / pi / Dokuments / subfolder , you can try the following:
os.chdir(os.path.join(os.getcwd(), "subfolder"))
In the shell, it ~refers to the home directory of the calling user ( $HOME).
~
$HOME
os.chdir . , os.chdir("~") cd ~ ( ), .
os.chdir
os.chdir("~")
cd
os.path.expanduser ~ $HOME:
os.path.expanduser
os.chdir(os.path.expanduser('~'))
, os.path.expanduser ~user, $HOME user.
~user
user
Source: https://habr.com/ru/post/1694014/More articles:Does user input enter an integer sufficient to sanitize it? - castingcheck point ssl network extender install mac os safari - sslComparing and merging tuples in Python - pythonAnimated SVG Animation - Squishy Effect - javascriptHow to close stdin in Node? - node.jsHow to remove duplicates from a subset of rows in pandas framework? - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1694016/github-graphql-api-default-branch-in-repository&usg=ALkJrhjCQ2DrAfvIngDMm5knGNWQTfpKeAVueJS 2 Cli converts POST to GET requests using Dev Server - javascriptΠ£ΠΌΠ½ΠΎΠΆΡΡΠ΅ ΠΊΠ°ΠΆΠ΄ΡΠΉ ΡΡΠΎΠ»Π±Π΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π° numpy Ρ ΠΊΠ°ΠΆΠ΄ΡΠΌ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ΠΌ Π΄ΡΡΠ³ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π° - pythonMongoose ΠΎΠ±ΡΠ΅Π΄ΠΈΠ½ΡΠ΅Ρ Π΄Π²Π° Π·Π°ΠΏΡΠΎΡΠ° Π΄Π»Ρ ΠΎΠ΄Π½ΠΎΠΉ ΠΊΠΎΠ»Π»Π΅ΠΊΡΠΈΠΈ - javascriptAll Articles