㈠ 帮帮我看看这个程序,python简明教程的脚本例子

# 1. The files and directories to be backed up are specified in a list.
source=[r'C:\work1',r'D:\Work']
就是把要备份的目录或者文件都统一的放在这个列表里。列表中r的作回用是取消字符串转义,即答\w不会被转义。这里指定的都是绝对路径,所以和在哪个盘是没有关系的。

# 2. The backup must be stored in a main backup directory
target_dir=r'D:\yss' #Remember to change this to what you will be using
后面这里指定了备份的目标文件,就是source里面指定的文件或者文件夹都会被备份到target_dir中去。

㈡ 用PYTHON写脚本

importos
#在当前目录下创建文件夹
os.mkdir('newfile')
os.mkdir('newfile/commence')
#或者直接用下面这条代码一内次性创建这容两个文件夹
#os.makedirs('newfile/commence')

㈢ python如何控制同一时间只能运行一个脚本实例

可以使用文件互斥,或者共享内存互斥
只要能找到一个互斥的方法就可以了!

㈣ 写一个python脚本

#!/usr/bin/env python
import sys

str = True
while (str):
dig = int(input())
if dig > 100:
print 'please input mun between 0~100'
elif dig >= 90:
print 'A'
elif dig >= 80:
print 'B'
elif dig >= 70:
print 'C'
elif dig >= 60:
print 'D'
elif dig <60:
print 'E'
else:
break

㈤ 使用Python实现命令行闹钟脚本实例有哪些

importsys
importstring
fromtimeimportsleep

sa=sys.argv
lsa=len(sys.argv)
iflsa!=2:
print"Usage:[python]alarm_clock.pyration_in_minutes"
print"Example:[python]alarm_clock.py10"
print"."
print"."
print"PressCtrl-."
sys.exit(1)

try:
minutes=int(sa[1])
exceptValueError:
print"Invalidnumericvalue(%s)forminutes"%sa[1]
print"Shouldbeaninteger>=0"
sys.exit(1)

ifminutes<0:
print"Invalidvalueforminutes,shouldbe>=0"
sys.exit(1)

seconds=minutes*60

ifminutes==1:
unit_word="minute"
else:
unit_word="minutes"

try:
ifminutes>0:
print"Sleepingfor"+str(minutes)+unit_word
sleep(seconds)
print"Wakeup"
foriinrange(5):
printchr(7),
sleep(1)
exceptKeyboardInterrupt:
print"Interruptedbyuser"
sys.exit(1)

㈥ 有没有简单一点的Python小例子小项目

http://www.chuanke.com/v4500746-178215-927115.html
免费的零基础10天python入门课程,每节课后都有一个作业,难版度由浅入深。权

㈦ 怎么在一个python脚本里调用另一个python脚本

from 脚本名 import *
若还是不能调,则把类实例化一下
f=类名()
然后f.函数名()就能调了。

㈧ python 简单脚本 初学者请大家帮忙

#!/usr/bin/python3
inputfile=open('test.txt')
l1=inputfile.readlines()
l1=[x.split('\t\t') for x in l1]
l1=[[x[0],x[1].replace('\n','')]for x in l1]
inputfile.close()
l2=''
for x in l1:
if x[1]!='OK':
l2+= (x[0]+'\t\t'+x[1])
outputfile=open('result.txt','w')
outputfile.write(l2)
outputfile.close()
~

㈨ Python 如何写脚本

以Python2.7操作为例:抄

1、首先需要袭打开电脑桌面,按开始的快捷键,点击Python2.7如图所示的选项进入。