ammdias,
@ammdias@masto.pt avatar

@villares

To remove the endline character, rstrip() should be used, to preserve the whitespace at the start of the line. To check for an empty line, maybe isspace() is more efficient?

items = [line.rstrip() for line in f if not line.isspace() and not line.lstrip().startswith('#')]

EDIT: this assumes a comment cannot be added in the end of the line (e.g. like in Python).

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • DreamBathrooms
  • everett
  • osvaldo12
  • magazineikmin
  • thenastyranch
  • rosin
  • normalnudes
  • Youngstown
  • Durango
  • slotface
  • ngwrru68w68
  • kavyap
  • mdbf
  • InstantRegret
  • JUstTest
  • ethstaker
  • GTA5RPClips
  • tacticalgear
  • Leos
  • anitta
  • modclub
  • khanakhh
  • cubers
  • cisconetworking
  • megavids
  • provamag3
  • tester
  • lostlight
  • All magazines