Home  >  Q&A  >  body text

七牛python的API:上传文件的put_file 函数,其中参数file_path路径问题?

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

天蓬老师天蓬老师2741 days ago840

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 17:17:21

    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.

    reply
    0
  • Cancelreply