Skip to content

Commit 9f80604

Browse files
committed
Blacken
1 parent 6e796b5 commit 9f80604

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

how-to-check-if-a-python-string-contains-a-substring/check_substring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212

1313
# Using `in` is a readable way to check if a string contains a substring
1414
if "secret" in raw_file_content:
15-
print("Found!")
15+
print("Found!")

how-to-check-if-a-python-string-contains-a-substring/regex_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626

2727
# Iterate over all matches as Match objects
2828
for match in re.finditer(r"(secret)[\.,]", file_content):
29-
print(match)
29+
print(match)

how-to-check-if-a-python-string-contains-a-substring/string_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
# Use a for loop to inspect all matches
1717
for word in file_content.split():
18-
if "secret" in word:
19-
print(word)
18+
if "secret" in word:
19+
print(word)
2020

2121
# Use a list comprehension and a conditional check for a one-liner
2222
print([word for word in file_content.split() if "secret" in word])

0 commit comments

Comments
 (0)