When reading the .data file, it can only be read by with open(' ','r') as f:, and finally saved as a csv file. The process is usually
1. Do a= strip().split('') first to get a list, but at this time a[i](i=1,2,...) is a str attribute, such as 'uid 130', ' aid 520'
2. Store the above obtained in the dictionary, dict[a[0]] = ' '.join(a[1:]) This step is to build the dictionary (=). 3. After getting the dictionary, you can append it directly in a list, eg: list.append(dict), what you get at this time is [{' ':' ',' ':' ',...}]
4. The last thing is to convert the list into a DataFrame. Here you can see that the DataFrame automatically uses the key value in the dictionary as columns
If you don't make a dictionary, append will become like this after strip()split('') directly