你的家"是指正在执行像 cd ~/MyDocuments/ 这样的命令的用户的家是 cd/home/user_executing_cd_commnd/MyDocumentsI'm a web application development noob. I have a function that opens a file and reads it. Unfortunately, the directory structures between the test and production servers differ. I was told to "use a path relative to ~". I haven't been able to find any resources on the '~', though!How do I use the tilde character in the context of paths?EDIT: This is in Python. I fixed the problem, using os.path.expanduser('~/path/in/home/area'). 解决方案 it is your $HOME var in UNIX, which usually is /home/username."Your home" meaning the home of the user who's executing a command like cd ~/MyDocuments/ is cd /home/user_executing_cd_commnd/MyDocuments 这篇关于如何在路径上下文中使用“~"(波浪号)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!