mystr = 'adfa\n\n\ndsfsf'
print("".join([s for s in mystr.splitlines(True) if s.strip()]))

 

相关文章:

  • 2021-08-08
  • 2022-12-23
  • 2022-02-11
  • 2022-02-17
  • 2021-11-01
  • 2022-01-19
  • 2021-11-01
猜你喜欢
  • 2021-11-15
  • 2022-01-07
  • 2021-10-09
  • 2022-01-09
  • 2022-12-23
  • 2021-11-22
相关资源
相似解决方案