Python
骑码找马
学习编程
展开
-
获取文件夹下所有文件名Python
import os import random filePath = 'I:\\AZB_MPI\\MyProject\\src\\src\\' list_data=os.listdir(filePath) file = open('I:\\AZB_MPI\\MyProject\\x.txt', 'w+') for i in list_data: file.write(i+'\n') file.close()原创 2021-08-05 21:04:41 · 163 阅读 · 0 评论 -
第一个爬虫
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. import requests import random from bs4 import BeautifulSoup.原创 2020-10-11 22:06:43 · 999 阅读 · 0 评论 -
【Python】数组的使用
Python中数组又叫列表: list1 = ['physics', 'chemistry', 1997, 2000] list2 = [1, 2, 3, 4, 5 ] list3 = ["a", "b", "c", "d"] print "list1[0]: ", list1[0] print "list2[1:5]: ", list2[1:5] list = [] ## 空列表 list.append('Google') ## 使用 append() 添加元素 list原创 2020-09-04 00:15:12 · 316 阅读 · 0 评论 -
【Python】循环、判断
if __name__ == '__main__': print_hi('PyCharmgrggdfvdfvdf') for i in range(1, 5): for j in range(1, 5): for k in range(1, 5): if (i != k) and (i != j) and (j != k): print(i, j, k)原创 2020-09-03 23:55:41 · 153 阅读 · 0 评论
分享