我是新来的,也是 Python 的新手。我不知道是什么f在print(f'Column names are {"-".join(row)}')做我试着删除它,然后“列名是{‘ - ’加入(行)}”成为普通的字符串
你能告诉我什么f叫,所以我可以谷歌了解更多信息吗?谢谢你们。
import csv
with open('CSV_test.txt') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count == 0:
print(f'Column names are {"-".join(row)}')
line_count += 1
else:
print(f'\t{row[0]} works in the {row[1]} '
f'department, and was born in {row[2]}.')
line_count += 1
print(f'Processed {line_count} lines.')
Run Code Online (Sandbox Code Playgroud)