当前位置:网站首页>Pysmb usage
Pysmb usage
2022-06-13 00:57:00 【Python's path to becoming a God】
install pysmb
pip install pysmb
I installed 1.2.7
Use pysmb
from smb.SMBConnection import SMBConnection
# And samba Server establishes connection
# -*- coding: utf-8 -*-
# @Time : 2022/2/26 9:46
# @Author : heyubin
# @Email : [email protected]
# @File : pysmb_test.py
from smb.SMBConnection import *
# param1:username
# param2:password
# param3:local NetBIOS machine name
# param4:remote NetBIOS machine name
samba = SMBConnection("17358882238", "19990123hyb", '', '') # By default ,samba Agreed NetBIOS Is turned off , So fill in the blank
# param1: samba Server's IP Address
assert samba.connect("192.168.1.121") # Connect samba The server
# Upload files
f = open("python.txt", 'rb') # It is recommended to use b Model open file , Tests have found that there are always some strange problems
# param1: samba Shared path of the server
# param2: Under the common path , File path ( Here, you need to specify upload to samba Which file on the server , If not, it will create a ),
# param3: You need to upload the object of the file ( The class to which this object belongs must have read() Method )
samba.storeFile('17358882238_Home1', 'Public/python.txt', f)
f.close()
# Download the file
f = open("test.txt", 'wb')
# param1: samba Shared path of the server
# param2: Under the shared path , File path
# param3: You need to download the object of the file
samba.retrieveFile('17358882238_Home1', "Public/DPU.txt", f)
f.close()
# samba Objects and many others API function
# samba.createDirectory()
# samba.deleteDirectory()
# samba.deleteFiles()
# samba.listShares()
# samba.listPath()
samba.close()
边栏推荐
- [virtual machine] notes on virtual machine environment problems
- Unity extension
- AOF持久化
- Common skills of quantitative investment -- Drawing Part 1: Drawing stock closing price curve and ochl candle chart
- Download nail live playback through packet capturing
- The grass is bearing seeds
- [backtrader source code analysis 7] analysis of the functions for calculating mean value, variance and standard deviation in mathsupport in backtrader (with low gold content)
- [imx6ull] video monitoring project (USB camera +ffmepeg)
- pytorch和tensorflow有什么区别?
- Key point detection data preparation and model design based on u-net Network -- detection model of four key points of industrial components
猜你喜欢

Common skills for quantitative investment - indicators Chapter 3: detailed explanation of RSI indicators, their code implementation and drawing
![[JS] battle chess](/img/1f/83ca6bcb000a5567dc6d3b72463ff8.jpg)
[JS] battle chess

gpu加速pytorch能用吗?

Addition and modification of JPA

(01). Net Maui actual construction project

Traditional machine learning classification model predicts the rise and fall of stock prices

Minimum spanning tree problem

Mysql database password modification
![[JS component library] drag sorting component](/img/f9/4090b52da1a5784b834cb7dbbb948c.jpg)
[JS component library] drag sorting component

Arduino control soil moisture sensor
随机推荐
pytorch和tensorflow有什么区别?
[003] embedded learning: creating project templates - using stm32cubemx
sort
[JS] battle chess
[JS component] custom paging
[virtual machine] notes on virtual machine environment problems
市值破万亿,连续三个月销量破10万,比亚迪会成为最强国产品牌?
深度学习模型剪枝
3623. Merge two ordered arrays
Liu Hui and introduction to nine chapter arithmetic and island arithmetic
.net core 抛异常对性能影响的求证之路
[server data recovery] successful cases of data loss recovery during data migration between storage servers
牌好不好无法预料
Zhouchuankai, Bank of Tianjin: from 0 to 1, my experience in implementing distributed databases
MySQL异常:com.mysql.jdbc.PacketTooBigException: Packet for query is too large(4223215 > 4194304)
How many steps are appropriate for each cycle of deep learning?
Get preview of precast body
Pipeline流水线项目构建
Deep learning model pruning
Tree - delete all leaf nodes