当前位置:   article > 正文

Python编程从入门到实践第10章习题答案_实验十中文文本分析答案

实验十中文文本分析答案
#10-1Python学习笔记
file_path = 'E:\python_work\example\learing_python.txt'
with open(file_path) as file_object:
	#print(file_object.read())
	
	lines = file_object.readlines()
	# for line in lines:
		# print(line.rstrip())

string = ''
for line in lines:
	string += line.rstrip()	
print(string) 

#10-2 C语言学习笔记
string = ''
for line in lines:
	string += line.replace('Python','C')
print(string)


#10-4访客名单
user_infor = input('Please enter your name: ')
print("Hello, " + user_infor.title())

file_path = 'E:\python_work\example\guest_book.txt'
with open(file_path,'a') as file_object:
	file_object.write(user_infor.title() + 'has a visist your space\n')

#10-5关于编程的调查
filename = 'reason_book.txt'

responses = []
while True:
    response = input("\nWhy do you like programming? ")
    responses.append(response)

    continue_poll = 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/376271
推荐阅读
相关标签
  

闽ICP备14008679号