We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(8)
首先,您可以从 Python 文档索引开始学习 Python 基础知识。 同样有趣的是教程、图书馆参考资料。 对于系统管理员,您可以使用的一些库是,举几个
os.walk() -> os.walk() -> 递归目录查找文件
os.path.join() -> os.path.join() -> 连接文件路径
os.getmtime()、os.getatime() -> 文件时间戳
os.remove()、os.removedirs() -> 删除文件
os.rename() -> os.rename() -> 重命名文件..
还有更多...请参阅 help(os) 了解更多操作系统内容...
大多数情况下,作为系统管理员,您将需要读/写文件,因此了解如何执行此操作
a) 使用 for 循环
b) 带有文件句柄
<前><代码> f=open("文件")
对于 f 中的行:
打印行
f.close()
c) 使用 while 循环
<前><代码> f=open("文件")
而1:
行=f.readline()
如果不是线:中断
打印行
f.close()
datetime, time -> 处理日期和时间,例如计算有多少天或两个日期之间的差异等
fileinput -> 用于就地编辑文件。
md5 或 hashlib -> 计算哈希摘要/md5,例如查找重复文件...
当然,还有更多,但我将其留给您探索。
First, you can start off the learn the basics of Python at Python documentation Index. Also of interest there would be the tutorial, library references. For sysadmin, some of the libraries you can use are , to name a few
os.walk() -> recursive directories looking for files
os.path.join() -> join file paths
os.getmtime(), os.getatime() -> file timestamp
os.remove(), os.removedirs() -> remove files
os.rename() -> rename files ..
and many more... please see help(os) for more operating system stuffs...
most often times as a sysadmin, you will need to read/write files so learn about doing that
a) using for loop
b) with a file handle
c) using while loop
datetime, time -> handle date and time , such as calculating how many days old or differences between 2 dates etc
fileinput -> for editing files in place.
md5 or hashlib -> calculating hash digest/md5 eg to find duplicate files ...
Of course, there are many more but i leave it to you to explore.
Mark Pilgrim 的 http://www.diveintopython.net/ 非常好且清晰。
Mark Pilgrim's http://www.diveintopython.net/ is very good and clear.
+1 深入了解 Python 和 Python 简述。 我还强烈推荐 effbot 的标准库指南。 您可能还想查看 Python Cookbook 以获取一些很好的示例惯用的 Python 代码。 查看 Python 网络基础,继续 SysAdmin 书籍中未完成的部分网络协议条款(仅供参考:所有 APress 书籍均以 PDF 形式提供,我很喜欢)
+1 for Dive into Python and Python in a Nutshell. I also highly recommend effbot's Guide to the Standard Library. You'll probably also want to check out the Python Cookbook for some good examples of idiomatic Python code. Check out Foundations of Python Networking to pick up where the SysAdmin book leaves off in terms of network protocols (fyi: all APress books are available as PDFs, which I love)
如果你不懂Python,你可以从这里开始:Dive into Python(如果你懂一点编码)。 这是免费下载的。 Python.org 上的 Python 教程 也非常好,我大部分都是从这里学习的并深入了解 Python 。 您还可以先观看Google技术讲座视频。 标题说Python适合程序员,但它仍然有帮助。 一旦你知道了这一点,据我所知,你提到的用于 Unix 和 Linux 系统管理的 Python 是一个非常好的和足够的。 我强烈建议您在了解使用 Python 进行系统管理的细节之前先学习它的基础知识。
快乐的Python。
If you don't know Python, you can start from here: Dive into Python (if you know a bit of coding). It's a free download. The Python tutorial at Python.org is also very good, I learned mostly from here and Dive into Python. You can also start by watching this Google Tech Talk Video. The title says Python for programmers, but it's still helpful. Once you know this, from what I heard, Python for Unix and Linux System Administration you mentioned is a very good and sufficient one. I highly recommend that you learn the basics of it before going into the specifics of system administration using Python.
Happy Python.
我认为您希望将 Python in a Nutshell 放在您的书架上。 亚历克斯·马尔泰利 (Alex Martelli) 撰写的优秀、详尽的参考资料。
I think you'd want to include Python in a Nutshell on your bookshelf. Excellent, thorough reference, by Alex Martelli.
Python入门:从新手到专业人士是一本很棒的书。
我可以推荐它。
Beginning Python: From Novice to Professional is an excellent book.
I can recommend it.
我还从 python.org 上的 Python 教程开始,它让我很快上手,之后我正在阅读 O'Reilly 的 Python 编程。
I also started from the Python tutorial on python.org and it got me started rather quick, after this i'm reading O'Reilly's Programming Python.
我从 Mark Lutz 的《Python 编程》(O'Reilly)开始。
I started with Mark Lutz's Programming Python (O'Reilly).