七牛python的API:上传文件的put_file 函数,其中参数file_path路径问题?
天蓬老师
天蓬老师 2017-04-17 17:15:21
0
1
890

请问下,在put_file函数中的路径file_path参数,是输入绝对路径还是相对路径,如果绝对路径,Windows和linux平台的路径也有所不同。

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
Ty80

Indicates that the level of questioning needs to be improved

Is the put_file you are talking about the function here?

The internal call is os.stat, which can be a relative path or an absolute path.

You don’t need to care about the beginning of the absolute path. There are related functions that can help you operate, such as:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

You can also write your own function judgment, or set environment variables, etc.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template