Finding the username

  • Comments posted to this topic are about the item Finding the username

  • Now that is really interesting; thank for the question, Steve

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”

  • Normally I would not use a regexp for such a simple task, two splits and a for loop is enough and much more readable:

    for i in str.split("\n")[1:]:
    print(i.split("@")[0])

    And if the data gets bigger, the csv module might be a better solution.

    Btw: The variable name str shadows the built-in str class (in this case a minor issue, but imagine naming your variable list ;))

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply