printer.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:PRET 作者: RUB-NDS 项目源码 文件源码
def do_get(self, arg, lpath="", r=True):
    "Receive file:  get <file>"
    if not arg:
      arg = raw_input("Remote file: ")
    if not lpath:
      lpath = self.basename(arg)
    path = self.rpath(arg) if r else arg
    str_recv = self.get(path)
    if str_recv != c.NONEXISTENT:
      rsize, data = str_recv
      lsize = len(data)
      # fix carriage return chars added by some devices
      if lsize != rsize and len(conv().nstrip(data)) == rsize:
        lsize, data = rsize, conv().nstrip(data)
      # write to local file
      file().write(lpath, data)
      if lsize == rsize:
        print(str(lsize) + " bytes received.")
      else:
        self.size_mismatch(rsize, lsize)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号