Format
Plain text
Post date
2019-04-16 18:51
Zeitraum der Veröffentlichung
Unbegrenzt
  1. #bduegf
  2. #001输出有多个出版社
  3. fi = open("book_list.csv","r")
  4. lines = fi.readlines()
  5. fl = lines[0]
  6. pub = set()
  7. for i in range(1,len(lines)):
  8. line = lines[i]
  9. line = line.strip()
  10. line = line.split(',')
  11. line = line[-1]
  12. line = line.split(':')
  13. line = line[-1]
  14. line = line.split('/')
  15. if ('、' in line[1]):
  16. line =line[1]
  17. line = line.split('、')
  18. for x in line:
  19. pub.add(x)
  20. else:
  21. line =line[0]
  22. pub.add(line)
  23. print(len(pub))
  24. print(pub)
  25. #统计评分>=8.5且评价人数>=2000的书的名字
  26. fl = fl.strip()
  27. fl = fl.split(',')
  28. pk=pek=nak=0
  29. for i in range(len(fl)):
  30. if fl[i] == '评分' :
  31. pk = i
  32. if fl[i] == '评价人数':
  33. pek = i
  34. if fl[i] == '书名':
  35. nak = i
  36. for i in range(1,len(lines)):
  37. line = lines[i]
  38. line = line.strip()
  39. line = line.split(',')
  40. # print(line[pk],line[pek],line[nak])
  41. if float(line[pk]) >= 8.5 and float(line[pek]) >= 2000:
  42. print(line[nak])
  43. fi.close()
Download Printable view

URL of this paste

Embed with JavaScript

Embed with iframe

Raw text