字符串太長 pep8python字符串前加f?Python f-strings or formatted strings are the new way to format strings. This feature was introduced in Python 3.6 under PEP-498. It’s also called literal string interpolation. Python f字符串或格式化的字符串是格式化字符串
可以轉成dictdefdictlist(node):res={}res[node.tag]={}python中的dict,xmltodict(node,res[node.tag])reply={}reply[node.tag]=res[node.tag]returnreplydefxmltodict(node,res):addict,rep={}iflen(node):#n = 0for n inlist(node):rep[node.tag
布爾索引布爾數組作為數組的索引時,會根據布爾數組的True False值,選擇對應軸上的數據進行篩選一個dataframe的數組_heartbeat_ a \0 NaN Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKi...python安裝numpy?1 NaN GoogleMaps/RochesterNY2 NaN Mozilla/4.0 (
復制代碼 代碼如下:
import os
import codecs
filenames=os.listdir(os.getcwd())
python處理excel數據、out=file("name.txt","w")
for filename in filenames:
out.write(filename.decode("gb2312").encode("utf-8"))
out.close()