Pyhton using Pexpect module for SVN chekout
One, install Pexpect
Pip Install Pexpect
Two, the Python script implementation
#!/usr/bin/env python# -*- coding: utf-8 -*-import pexpectusername = ' Admin ' password = ' passwd ' svnurl = ' Http://mysvnurl.com/svnproject ' if __name__ == ' __main__ ': svn_link = ' svn co --username=admin ' + svnurl + ' . ' # '. ' checkout in the current directory child = pexpect.spawn (svn_ Link) child.expect (' Password for \ ' admin\ ': ', timeout=none ' #如果子程序没有在指定的时间内生成任何 Output, then expect () and read () will produce TIMEOUT exceptions. #超时默认是 30s, available in expect () and spawn When the constructor is initialized, it is specified as a different time, such as: #child. Expect (' Password: ', timeout=120) # wait 120s #如果你想让 expect () and read () Ignore timeout limit, that is, block indefinitely until there is output generated, set The timeout parameter is none. child.sendline (password+ ' \ n ') child.expect (' store password unencrypted (yes/no)? ') child.sendline (' yes\n ') pass
Python implements automatic svn checkout