- 博客(9)
- 收藏
- 关注
原创 Python编程快速上手——让繁琐工作自动化第十二章实践题
##12.13.1 import openpyxl, sys from openpyxl.utils import get_column_letter from openpyxl.styles import Font shuzhi = sys.argv[1] wb = openpyxl.Workbook() sheet = wb.get_active_sheet() geshi = Font...
2019-01-20 13:03:59
799
原创 Python编程快速上手——让繁琐工作自动化第十章实践题
##10.8 import random guess = '' while guess not in ('heads', 'tails'): print('Guess the coin toss! Enter heads or tails:') guess = input() toss = random.randint(0, 1) #变量toss的值是0或1,而变量guess的值是...
2019-01-12 15:34:52
525
原创 Python编程快速上手——让繁琐工作自动化第九章实践题
##9.8.1 import os, shutil def beifen(): if not os.path.isdir(beifen_mulu): os.makedirs(beifen_mulu) for foldername, subfolders, filenames in os.walk(chazhao_mulu): for filenam...
2019-01-11 23:05:33
702
原创 Python编程快速上手——让繁琐工作自动化第八章实践题
##8.9.1 import shelve, pyperclip, sys mcbShelf = shelve.open('mcb') if len(sys.argv) == 3: if sys.argv[1].lower() == 'save': mcbShelf[sys.argv[2]] = pyperclip.paste() elif sys.argv[1]....
2019-01-02 21:09:49
689
原创 Python编程快速上手——让繁琐工作自动化第七章实践题
##7.18.1 import re def yanzheng(zifu): if len(zifu) < 8: print('密码长度不足8位') elif re.compile(r'[A-Z]').search(mima) == None: print('密码中须包含大写字母') elif re.compile(r'[a-z]')...
2018-12-31 22:24:29
725
1
原创 Python编程快速上手——让繁琐工作自动化第六章实践题
##6.7 tableData = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']] def printTable(data): zifuchang =...
2018-12-31 10:57:08
640
原创 Python编程快速上手——让繁琐工作自动化第五章实践题
##5.6.1 参照书中提示答案 ##5.6.2 def hanshu1(canshu1, canshu2): for a in canshu2: ziliao[a] = (canshu1.get(a, 0) + 1) return ziliao def hanshu2(canshu): print("Inventory: ") zongliang...
2018-12-27 20:19:55
606
1
原创 Python编程快速上手——让繁琐工作自动化第四章实践题
##4.10.1 def hanshu1(list2): str1 = list2[0] + ', ' + 'and ' + list2[1] print(str1) def hanshu2(list2): str1 = list2[0] str2 = ', ' + 'and ' + list2[-1] for a in range(1,(len(list...
2018-12-26 20:25:00
563
1
原创 Python编程快速上手——让繁琐工作自动化第三章实践题
3.11.1 def collatz(number): if number % 2 == 0: print(number // 2) return(number // 2) else: print(number * 3 + 1) return(number * 3 + 1) print(&amp;amp;quot;Enter number: ...
2018-12-24 22:21:14
315
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅