我有一個 Ubuntu 16.04 盒子(外部伺服器),並且有一堆 python 檔案。每當我嘗試將這些檔案透過 FTP 傳輸到本機電腦並打開 python 檔案時,程式碼都無法正確對齊。
我相信在傳輸過程中對齊會被破壞。
我該如何解決這個問題?我在 Mac 上,用來cyberduck
傳輸這些檔案。
如果您發現在我透過 ftp 傳輸程式碼後 try 語句未對齊。這只是一個快照。許多行沒有正確對齊:
for pano in test_images:
import time
#time.sleep(30)
print "Reading ",pano
t_start = dt.datetime.now()
try:
orig_img = cv2.imread(pano)[:,:,:3]
'''
round_y = orig_img.shape[0]%J["h_stride"]
r_y = J["h_stride"]-round_y if round_y > J["h_stride"]/2 else -round_y
round_x = orig_img.shape[1]%J["w_stride"]
r_x = J["w_stride"]-round_x if round_x > J["w_stride"]/2 else -round_x
orig_img = imresize(orig_img, ( orig_img.shape[0]+round_y, orig_img.shape[0]+round_x) )
'''
except:
continue
遠端檔案:
for pano in test_images:
import time
#time.sleep(30)
print "Reading ",pano
t_start = dt.datetime.now()
try:
orig_img = cv2.imread(pano)[:,:,:3]
'''
round_y = orig_img.shape[0]%J["h_stride"]
r_y = J["h_stride"]-round_y if round_y > J["h_stride"]/2 else -round_y
round_x = orig_img.shape[1]%J["w_stride"]
r_x = J["w_stride"]-round_x if round_x > J["w_stride"]/2 else -round_x
orig_img = imresize(orig_img, ( orig_img.shape[0]+round_y, orig_img.shape[0]+round_x) )
'''
except:
continue