python script

1.tab键自动补全(每次导入时要将脚本的路径加入到sys.path中)

import sys
import readline
import rlcompleter
import atexit
import os
# tab completion
readline.parse_and_bind(‘tab: complete‘)
# history file
histfile = os.path.join(os.environ[‘HOME‘], ‘.pythonhistory‘)
try:
    readline.read_history_file(histfile)
except IOError:
    pass
atexit.register(readline.write_history_file, histfile)

del os, histfile, readline, rlcompleter

时间: 2024-10-06 01:13:57

python script的相关文章

my python script (1) ---------create model script file

# my  python script #  to create script file #!/usr/bin/env python # -*- coding:utf-8 -*- import os,subprocess child = subprocess.Popen('which python',stdout = subprocess.PIPE,shell=True) (pypath,error) = child.communicate() pypath = pypath.strip('\n

Notepad++插件Python Script和Emmet的安装使用教程(转载)

安装插件Python Script和Emmet: 最近在做一个项目,涉及到大量的HTML.CSS代码的编写,手动写代码效率实在是低下.于是想搜索一下,有没有Notepad++插件可以支持自动生成的,果不其然还真有.Emmet,这款神器其实就是 Zen Coding的升级版,它可以极大的提高代码编写的效率,并提供了一种非常简练的语法规则,立刻生成对应的 HTML 结构或者 CSS代码,同时还有多种实用的功能帮助进行前端开发. Emmet支持多种编辑器,如Sublime Text 2,TextMat

Notepad++插件Emmet和Python Script的安装

最近在做一个项目,涉及到大量的HTML.CSS代码的编写,手动写代码效率实在 是低下.于是想搜索一下,有没有Notepad++插件可以支持自动生成的,果不其然还真有.Emmet,这款神器其实就是 Zen Coding 的升级版,它可以极大的提高代码编写的效率,并提供了一种非常简练的语法规则,立刻生成对应的 HTML 结构或者 CSS 代码,同时还有多种实用的功能帮助进行前端开发. Emmet支持多种编辑器,如Sublime Text 2,TextMate 1.x,Eclipse/Aptana,E

[Python] Execute a Python Script

Python scripts can be executed by passing the script name to the python command or created as executable commands that can run stand-alone. You’ll learn how to create both in this lesson. script.py: print("Hello World") When we want to run the s

Python script to create Screen from all Items/Graphs of a host

#!/usr/bin/env python import urllib2 import json import argparse def authenticate(url, username, password): values = {'jsonrpc': '2.0', 'method': 'user.login', 'params': { 'user': username, 'password': password }, 'id': '0' } data = json.dumps(values

My first python script for work

I write it yesterday to watch the NE process(rcpfd,cfgd) automatically, then i will write a window to implement it: #! /usr/bin/env python # -*- coding: UTF-8 -*- import paramikoimport sshimport osimport reimport time#RCPD异常类class RCPD_Exception(Exce

Remote rsyslog server records the logs of python script

Ubuntu 14.04.1 LTS rsyslog server:  10.0.7.77 python client: 10.0.2.122 [rsyslog server] 1.Install rsyslog with apt-get sudo apt-get install -y rsyslog 2.edit /etc/rsyslog.conf ,uncomment this line $ModLoad immark # provides --MARK-- message capabili

Autorun a python script after reboot using rc.local

1. /home/lvtest/test/test.py from datetime import datetime now=datetime.now() f=open('test.log','a') f.write('%s '%now) f.close() 2. edit /etc/rc.local with adding codes below: cd /home/lvtest/test su lvtest -c "python /home/lvtest/test/test.py"

pycharm默认的模板修改python script

#!/usr/bin/env python # encoding: utf-8 #set( $SITE = "https://www.cnblogs.com/c-x-a" ) """ @version: v1.0 @author: cxa @contact: [email protected] @site: ${SITE} @software: ${PRODUCT_NAME} @file: ${NAME}.py @time: ${DATE} ${TIME}

NE Upgrade python script. Need to write a Tkinter GUI for it

# -*- coding: utf-8 -*-#from ftplib import FTP __authour__='CC' import osimport telnetlibimport timeimport shutilimport socket#import pdbimport paramikofrom Tkinter import *import globimport re def get_version_path(n1,n2,n3): if(int(n2)==0 and int(n1