This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alvarezdqal
Recipients alvarezdqal
Date 2021-04-20.21:55:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1618955708.38.0.581362261608.issue43900@roundup.psfhosted.org>
In-reply-to
Content
As of now the best way to filter a str is to convert to list, filter, then join back to a str. I think a a string comprehension would be very useful for this.


So to get only ascii_lower case chars given this string,
````
s = "a1b2c3d4"
````

I could do this
````
filtered_s = c"ch for ch in s if ch in string.ascii_lowercase"
````

instead of this.
````
s_list = []
for i in range(len(s)):
    if s[i] in string.ascii_lowercase:
        s_list.append(s[i])

filtered_s = "".join(s_list)
````
History
Date User Action Args
2021-04-20 21:55:08alvarezdqalsetrecipients: + alvarezdqal
2021-04-20 21:55:08alvarezdqalsetmessageid: <1618955708.38.0.581362261608.issue43900@roundup.psfhosted.org>
2021-04-20 21:55:08alvarezdqallinkissue43900 messages
2021-04-20 21:55:07alvarezdqalcreate