python编程---example23
filename = '../learning_python.txt'
with open(filename) as f:
lines = f.readlines()
for line in lines:
line = line.rstrip()
print(line.replace('python','C'))
filename = '../learning_python.txt'
with open(filename) as f:
lines = f.readlines()
for line in lines:
line = line.rstrip()
print(line.replace('python','C'))
die.py from random import randint class Die(): def __init__...
客: 编写一个程序,提示用户输入其名字;用户作出响应后,将其名字写入到guest.txt文件中。 filename = 'guest.txt' ...
filename = '../learning_python.txt' with open(filename) as f: lines ...
filename = 'learning_python.txt' print("--- Reading in the entire file:")...
这个例子是关于python module调用的,python module是 .py 的文件 pizza.py def make_pizza(s...
定一个数组和目标数target,找出数组中a,b,c满足 a+b+c = target 的所有组合。 def sum_of_three(arr,target):...
速排序算法。 def quick_sort(arr,start=0,end=None): if end is None: end = l...
定一个数组,找出其所有可能的排列。 import numpy as np def permutations(arr): if len(arr)...
one alien_o = {'color':'green','points':5} new_points = alien_o['points...
写一个python脚本,猜数字。 import random secretNumber = random.randint(1,20) prin...
还没有评论,来说两句吧...