Home > other > Python OS system how to read TXT data
Python OS system how to read TXT data
Time:09-30
As title, I ask you thank
CodePudding user response:
Method are many, the simplest is the open directly, readlines
File_data=https://bbs.csdn.net/topics/open (' dd2. TXT ', 'r', encoding='utf8') List2=file_data. Readlines () Data_list2=[n.s trip (' \ n \ r '). The upper () for n list2 in [1]] File_data. Close () Print (len (data_list2))