Jump to content

boparai

Member
  • Posts

    6
  • Joined

  • Last visited

Reputation Activity

  1. Like
    boparai got a reaction from SuperJeRoT in LoL Found SLICK in Thor : The Dark World   
    LOL:)
  2. Like
    boparai got a reaction from Corvus in LoL Found SLICK in Thor : The Dark World   
    LOL:)
  3. Like
    boparai got a reaction from Vitalius in LoL Found SLICK in Thor : The Dark World   
    LOL:)
  4. Like
    boparai got a reaction from Nineshadow in LoL Found SLICK in Thor : The Dark World   
    LOL:)
  5. Like
    boparai got a reaction from flibberdipper in LoL Found SLICK in Thor : The Dark World   
    LOL:)
  6. Like
    boparai got a reaction from RectangularBox in [Python] What would be the best way to remove everything but letters?   
    the first line is compiling a regular for later use.
     
    I'll explain piece by piece :
     
    r' ' : it for python raw strings for unconflicting regex
    [ ] : are selectors to specify which characters and/or range of characters to find
    A-Z: specify all upper case letters and a-z all lower  case letters
    + : is a greedy meta-character which tells the regex engine to find 1 or more characters which match earlier criteria
     
    lets  see an example :http://docs.python.org/2/howto/regex.html
     
    string = 'i_am doing**it ^&wrong 1234'
     
    and we're using findall so it will well find all parts of the string that match our regex and return a list
     
    list = ['i','am','doing','it','wrong']
     
    and then join everything in the list with the blank string and return "iamdoingitwrong"
     
    Although it is a little bit complicated since you don't about regex much but it is a lot more safer and short and frankly it will far more easy when you learn about regex
     
    you can learn more about regex here : http://docs.python.org/2/howto/regex.html
  7. Like
    boparai got a reaction from alpenwasser in [Python] What would be the best way to remove everything but letters?   
    you would probably be better off using simple regex. Here :
     
     
    import redef only_alpha(text): regex = re.compile(r'[A-Za-z]+') ans = "".join(regex.findall(text)) return ans it should probably do it if you have any confusion about the regex just ask i'll explain it to you
×