【发布时间】:2019-12-02 15:09:53
【问题描述】:
我想将我的文件从 dbfs 保存或复制到我的桌面(本地)。我使用这个命令但得到一个错误:
dbutils.fs.cp('/dbfs/username/test.txt', 'C:\Users\username\Desktop')
Error: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
当我为我的案例查找 dbutils.fs.help() 时,我按照说明进行操作:
dbutils.fs provides utilities for working with FileSystems. Most methods in this package can take either a DBFS path (e.g., "/foo" or "dbfs:/foo"), or another FileSystem URI. For more info about a method, use dbutils.fs.help("methodName"). In notebooks, you can also use the %fs shorthand to access DBFS. The %fs shorthand maps straightforwardly onto dbutils calls. For example, "%fs head --maxBytes=10000 /file/path" translates into "dbutils.fs.head("/file/path", maxBytes = 10000)".
fsutils
cp(from: String, to: String, recurse: boolean = false): boolean -> Copies a file or directory, possibly across FileSystems
【问题讨论】:
标签: python databricks