def fix_place_string(s):à str i. 引數是s,一個字串。每個縣名都以地名結尾;如果它在某些地方正確結束,則什么都不做(只需回傳 s),否則將結束詞更正為適當的位置。具體來說,如果不修復它
uj5u.com熱心網友回復:
def fix_county_string():
""" Insert Docstring """
fp = open("michigan_COVID_08_24_21.txt", "r")
s = ''
for line in fp:
county = line[24:43]
x = county.split()
t = x.pop(-1)
x.append("County")
s =line ' '.join(x)
return s
s = fix_county_string()
我認為這就是您要嘗試做的事情,您可以將輸出寫回檔案中。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/318490.html
