40723108 cd2020

  • Home
    • Site Map
    • reveal
    • blog
  • 倉儲
  • week(1-9)
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
  • week(10-
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
  • 期末報告影片
  • 直播影片
    • w2
    • w3
    • w4.w5
    • w6
    • w7
    • w8
    • W9
    • w10
    • w11
    • w12
    • w13
    • w14
  • 分組倉儲
  • 翻譯
    • ch2
    • ch3
  • FFmpeg
3 << Previous Next >> 5

4

pj1-1亂數分組

Describe how to do an efficient random grouping for this course or do the roll calling randomly?


import random
List=[['40723104', '40723107', '40723114', '40723115', '40723118', '40723122', '40723123', '40723140', '40723149', '40723151', '40723153', '40723154', '40723155', '40623143', '40723108', '40723127', '40723132', '40723133', '40723137', '40723141', '40723143', '40723144', '40723147', '40723148', '40723150', '40723103', '40723110', '40723112', '40723120', '40723125', '40723126', '40723128', '40723130', '40723139', '40723142', '40723145', '40723146', '40423155', '40723101', '40723102', '40723106', '40723111', '40723119', '40723121', '40723124', '40723134', '40723135', '40723136', '40723138']]
#變數
List=List[0]
#將List數列隨機排列
random.shuffle(List)
#列印數列
print(List)
#數列(1~12)
print(List[0:12])
#數列(13~24)
print(List[12:24])
#數列(25~36)
print(List[24:36])
#數列(37~49)
print(List[36:49])

List=[['40723104', '40723107', '40723114', '40723115', '40723118', '40723122', '40723123', '40723140', '40723149', '40723151', '40723153', '40723154', '40723155', '40623143', '40723108', '40723127', '40723132', '40723133', '40723137', '40723141', '40723143', '40723144', '40723147', '40723148', '40723150', '40723103', '40723110', '40723112', '40723120', '40723125', '40723126', '40723128', '40723130', '40723139', '40723142', '40723145', '40723146', '40423155', '40723101', '40723102', '40723106', '40723111', '40723119', '40723121', '40723124', '40723134', '40723135', '40723136', '40723138']]

清單

List=List[0]

變數

random.shuffle(List)

使用random.shuffle隨機排列

print(List)

數列複印

print(List[a:b])

複印a-b

使用爬蟲程式來擷取網頁中的內容

網站https://buzzorange.com/techorange/2017/08/04/python-scraping/

來源https://nkust.gitbook.io/python/untitled


3 << Previous Next >> 5

Copyright © All rights reserved | This template is made with by Colorlib